clanker-sdk 4.2.10 → 4.2.12

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.
Files changed (40) hide show
  1. package/README.md +42 -9
  2. package/dist/{deploy-BvFgwMVl.d.ts → clankerTokenV4-DoIzm6GW.d.ts} +1822 -9
  3. package/dist/cli/cli.js +10456 -7324
  4. package/dist/cli/commands/airdrop.d.ts +8 -0
  5. package/dist/cli/commands/airdrop.js +8524 -0
  6. package/dist/cli/commands/deploy.d.ts +14 -0
  7. package/dist/cli/commands/deploy.js +9883 -0
  8. package/dist/cli/commands/presale.d.ts +5 -0
  9. package/dist/cli/commands/presale.js +9340 -0
  10. package/dist/cli/commands/rewards.d.ts +5 -0
  11. package/dist/cli/commands/rewards.js +8235 -0
  12. package/dist/cli/commands/setup.d.ts +5 -0
  13. package/dist/cli/commands/setup.js +314 -0
  14. package/dist/cli/commands/token.d.ts +5 -0
  15. package/dist/cli/commands/token.js +8120 -0
  16. package/dist/cli/commands/vault.d.ts +5 -0
  17. package/dist/cli/commands/vault.js +8128 -0
  18. package/dist/cli/create-clanker.js +29 -2
  19. package/dist/cli/utils/chains.d.ts +6 -0
  20. package/dist/cli/utils/chains.js +51 -0
  21. package/dist/cli/utils/config.d.ts +10 -0
  22. package/dist/cli/utils/config.js +31 -0
  23. package/dist/cli/utils/output.d.ts +14 -0
  24. package/dist/cli/utils/output.js +209 -0
  25. package/dist/cli/utils/style.d.ts +49 -0
  26. package/dist/cli/utils/style.js +129 -0
  27. package/dist/cli/utils/wallet.d.ts +22 -0
  28. package/dist/cli/utils/wallet.js +108 -0
  29. package/dist/deploy-BUDlDPzt.d.ts +6 -0
  30. package/dist/index.d.ts +25 -16
  31. package/dist/index.js +36 -2
  32. package/dist/legacyFeeClaims/index.js +25 -1
  33. package/dist/merkleTree-BNYdIOkH.d.ts +15 -0
  34. package/dist/v3/index.d.ts +4 -4
  35. package/dist/v3/index.js +28 -1
  36. package/dist/v4/extensions/index.d.ts +2 -1
  37. package/dist/v4/extensions/index.js +28 -1
  38. package/dist/v4/index.d.ts +5 -4
  39. package/dist/v4/index.js +28 -1
  40. package/package.json +2 -1
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // node_modules/.pnpm/tsup@8.4.0_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js
3
+ // node_modules/tsup/assets/esm_shims.js
4
4
  import { fileURLToPath } from "url";
5
5
  import path from "path";
6
6
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -3084,6 +3084,7 @@ import {
3084
3084
  arbitrum,
3085
3085
  base,
3086
3086
  baseSepolia,
3087
+ bsc,
3087
3088
  mainnet,
3088
3089
  monadTestnet,
3089
3090
  unichain
@@ -3102,7 +3103,7 @@ var monad = /* @__PURE__ */ defineChain({
3102
3103
  },
3103
3104
  rpcUrls: {
3104
3105
  default: {
3105
- http: ["TODO"]
3106
+ http: ["https://rpc.monad.xyz"]
3106
3107
  }
3107
3108
  },
3108
3109
  blockExplorers: {
@@ -3123,9 +3124,11 @@ var ANON_ADDRESS = "0x0Db510e79909666d6dEc7f5e49370838c16D950f";
3123
3124
  var HIGHER_ADDRESS = "0x0578d8A44db98B23BF096A382e016e29a5Ce0ffe";
3124
3125
  var CB_BTC_ADDRESS = "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
3125
3126
  var A0X_ADDRESS = "0x820C5F0fB255a1D18fd0eBB0F1CCefbC4D546dA7";
3127
+ var WBNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
3126
3128
  var WETH_ADDRESSES = {
3127
3129
  [mainnet.id]: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
3128
3130
  [arbitrum.id]: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
3131
+ [bsc.id]: WBNB_ADDRESS,
3129
3132
  [base.id]: "0x4200000000000000000000000000000000000006",
3130
3133
  [baseSepolia.id]: "0x4200000000000000000000000000000000000006",
3131
3134
  [unichain.id]: "0x4200000000000000000000000000000000000006",
@@ -3151,6 +3154,7 @@ import {
3151
3154
  arbitrum as arbitrum2,
3152
3155
  base as base2,
3153
3156
  baseSepolia as baseSepolia2,
3157
+ bsc as bsc2,
3154
3158
  mainnet as mainnet2,
3155
3159
  monadTestnet as monadTestnet2,
3156
3160
  unichain as unichain2
@@ -6168,6 +6172,29 @@ var CLANKERS = {
6168
6172
  feeStaticHookV2: "0x94F802a9EFE4dd542FdBd77a25D9e69A6dC828Cc",
6169
6173
  feeDynamicHook: "0x0000000000000000000000000000000000000000"
6170
6174
  }
6175
+ },
6176
+ clanker_v4_bnb: {
6177
+ abi: Clanker_v4_abi,
6178
+ token: {
6179
+ abi: ClankerToken_v4_abi,
6180
+ bytecode: ClankerToken_v4_bytecode
6181
+ },
6182
+ chainId: bsc2.id,
6183
+ type: "clanker_v4",
6184
+ address: "0xea30438E0B5f99096cb05A8Da63be55A6A298F6a",
6185
+ related: {
6186
+ locker: "0x1166022e1becc70E7E9aB2250aF1aC7842B9B420",
6187
+ vault: "0x15ee8382DBd8Fb991F653B59CA11bf504a07372D",
6188
+ airdrop: "0xBB0f069b995e0205cD5F92C84a1dF056a3F47900",
6189
+ devbuy: "0x302989E1cA167B6E78f9711e5a08d1BD555DdAc4",
6190
+ mevModule: "0xEE2940CC010820B7F22DF627e081d707693989a6",
6191
+ mevModuleV2: "0xec1310cf227a2D671176000aE0849DE6417b175a",
6192
+ feeLocker: "0x67D04Ae42F03D9b63dE0E6F2d82bB186A0306bBb",
6193
+ feeStaticHook: "0xC5d309026BCAb6630888d51CE21154AD2f4828cC",
6194
+ feeStaticHookV2: "0xC5d309026BCAb6630888d51CE21154AD2f4828cC",
6195
+ feeDynamicHook: "0x0000000000000000000000000000000000000000",
6196
+ feeDynamicHookV2: "0x011a8ed40095F2D7E9c19125B8254b19678D68Cc"
6197
+ }
6171
6198
  }
6172
6199
  };
6173
6200
  var Chains = [...new Set(Object.values(CLANKERS).map(({ chainId }) => chainId))];
@@ -0,0 +1,6 @@
1
+ import { Chain } from 'viem';
2
+
3
+ declare const CHAIN_NAMES: string[];
4
+ declare function resolveChain(name: string): Chain;
5
+
6
+ export { CHAIN_NAMES, resolveChain };
@@ -0,0 +1,51 @@
1
+ // src/cli/utils/chains.ts
2
+ import { arbitrum, base, baseSepolia, bsc, mainnet, unichain } from "viem/chains";
3
+
4
+ // src/utils/chains/monad.ts
5
+ import { defineChain } from "viem";
6
+ var monad = /* @__PURE__ */ defineChain({
7
+ id: 143,
8
+ name: "Monad",
9
+ blockTime: 400,
10
+ nativeCurrency: {
11
+ name: "MON",
12
+ symbol: "MON",
13
+ decimals: 18
14
+ },
15
+ rpcUrls: {
16
+ default: {
17
+ http: ["https://rpc.monad.xyz"]
18
+ }
19
+ },
20
+ blockExplorers: {
21
+ default: {
22
+ name: "Monad explorer",
23
+ url: "TODO"
24
+ }
25
+ },
26
+ contracts: {},
27
+ testnet: false
28
+ });
29
+
30
+ // src/cli/utils/chains.ts
31
+ var CHAIN_MAP = {
32
+ base,
33
+ "base-sepolia": baseSepolia,
34
+ arbitrum,
35
+ ethereum: mainnet,
36
+ bsc,
37
+ unichain,
38
+ monad
39
+ };
40
+ var CHAIN_NAMES = Object.keys(CHAIN_MAP);
41
+ function resolveChain(name) {
42
+ const chain = CHAIN_MAP[name];
43
+ if (!chain) {
44
+ throw new Error(`Unknown chain "${name}". Supported: ${CHAIN_NAMES.join(", ")}`);
45
+ }
46
+ return chain;
47
+ }
48
+ export {
49
+ CHAIN_NAMES,
50
+ resolveChain
51
+ };
@@ -0,0 +1,10 @@
1
+ interface ClankerConfig {
2
+ privateKey?: string;
3
+ rpc?: Record<string, string>;
4
+ defaultChain?: string;
5
+ }
6
+ declare function loadConfig(): ClankerConfig;
7
+ declare function saveConfig(config: ClankerConfig): void;
8
+ declare function getConfigPath(): string;
9
+
10
+ export { type ClankerConfig, getConfigPath, loadConfig, saveConfig };
@@ -0,0 +1,31 @@
1
+ // src/cli/utils/config.ts
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { join } from "node:path";
5
+ var CONFIG_DIR = join(homedir(), ".clanker");
6
+ var CONFIG_PATH = join(CONFIG_DIR, "config.json");
7
+ function ensureDir() {
8
+ if (!existsSync(CONFIG_DIR)) {
9
+ mkdirSync(CONFIG_DIR, { recursive: true });
10
+ }
11
+ }
12
+ function loadConfig() {
13
+ try {
14
+ if (!existsSync(CONFIG_PATH)) return {};
15
+ return JSON.parse(readFileSync(CONFIG_PATH, "utf-8"));
16
+ } catch {
17
+ return {};
18
+ }
19
+ }
20
+ function saveConfig(config) {
21
+ ensureDir();
22
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2), { mode: 384 });
23
+ }
24
+ function getConfigPath() {
25
+ return CONFIG_PATH;
26
+ }
27
+ export {
28
+ getConfigPath,
29
+ loadConfig,
30
+ saveConfig
31
+ };
@@ -0,0 +1,14 @@
1
+ import { Chain } from 'viem';
2
+
3
+ declare function getBanner(version: string): string;
4
+ declare function printBanner(version: string): void;
5
+ declare function blockExplorerUrl(chain: Chain, hash: string, type?: 'tx' | 'token'): string;
6
+ declare function printResult(data: Record<string, unknown>, jsonMode: boolean): void;
7
+ declare function printSuccess(message: string, jsonMode: boolean, data?: Record<string, unknown>): void;
8
+ declare function printError(error: unknown, jsonMode: boolean): void;
9
+ declare function printStep(message: string, jsonMode?: boolean): void;
10
+ declare function printInfo(label: string, value: string, jsonMode?: boolean): void;
11
+ declare function printWarning(message: string, jsonMode?: boolean): void;
12
+ declare function printKeyValue(data: Record<string, unknown>, jsonMode: boolean, title?: string): void;
13
+
14
+ export { blockExplorerUrl, getBanner, printBanner, printError, printInfo, printKeyValue, printResult, printStep, printSuccess, printWarning };
@@ -0,0 +1,209 @@
1
+ // src/cli/utils/style.ts
2
+ var isColorSupported = process.env.NO_COLOR === void 0 && process.env.FORCE_COLOR !== "0" && process.env.TERM !== "dumb" && (process.env.FORCE_COLOR !== void 0 || process.stdout.isTTY === true);
3
+ var ESC = "\x1B[";
4
+ var RST = `${ESC}0m`;
5
+ function wrap(code, text) {
6
+ if (!isColorSupported) return text;
7
+ return `${ESC}${code}m${text}${RST}`;
8
+ }
9
+ var bold = (s) => wrap("1", s);
10
+ var dim = (s) => wrap("2", s);
11
+ var red = (s) => wrap("31", s);
12
+ var green = (s) => wrap("32", s);
13
+ var yellow = (s) => wrap("33", s);
14
+ var cyan = (s) => wrap("36", s);
15
+ var gray = (s) => wrap("90", s);
16
+ var brightCyan = (s) => wrap("96", s);
17
+ function gradient(text, from, to) {
18
+ if (!isColorSupported) return text;
19
+ const chars = [...text];
20
+ const total = chars.length;
21
+ if (total === 0) return "";
22
+ return chars.map((ch, i) => {
23
+ if (ch === " ") return ch;
24
+ const t = total > 1 ? i / (total - 1) : 0;
25
+ const r = Math.round(from[0] + (to[0] - from[0]) * t);
26
+ const g = Math.round(from[1] + (to[1] - from[1]) * t);
27
+ const b = Math.round(from[2] + (to[2] - from[2]) * t);
28
+ return `${ESC}38;2;${r};${g};${b}m${ch}`;
29
+ }).join("") + RST;
30
+ }
31
+ var BRAND_FROM = [6, 182, 212];
32
+ var BRAND_TO = [168, 85, 247];
33
+ var SYM = {
34
+ check: isColorSupported ? "\u2714" : "+",
35
+ cross: isColorSupported ? "\u2716" : "x",
36
+ arrow: isColorSupported ? "\u25B8" : ">",
37
+ dot: isColorSupported ? "\u25CF" : "*",
38
+ star: isColorSupported ? "\u2605" : "*",
39
+ info: isColorSupported ? "\u2139" : "i",
40
+ warn: isColorSupported ? "\u26A0" : "!",
41
+ rocket: isColorSupported ? "\u{1F680}" : "^"
42
+ };
43
+ var BOX = {
44
+ tl: "\u256D",
45
+ tr: "\u256E",
46
+ bl: "\u2570",
47
+ br: "\u256F",
48
+ h: "\u2500",
49
+ v: "\u2502",
50
+ lt: "\u251C",
51
+ rt: "\u2524"
52
+ };
53
+ function stripAnsi(str) {
54
+ return str.replace(/\x1b\[[0-9;]*m/g, "");
55
+ }
56
+ function drawBox(lines, options) {
57
+ const color = options?.color || cyan;
58
+ const pad = options?.padding ?? 1;
59
+ const contentWidth = Math.max(
60
+ ...lines.map((l) => stripAnsi(l).length),
61
+ options?.title ? stripAnsi(options.title).length : 0,
62
+ 20
63
+ );
64
+ const innerWidth = contentWidth + pad * 2;
65
+ const out = [];
66
+ out.push(color(`${BOX.tl}${BOX.h.repeat(innerWidth)}${BOX.tr}`));
67
+ if (options?.title) {
68
+ const titleLen = stripAnsi(options.title).length;
69
+ const titlePad = innerWidth - titleLen - pad;
70
+ out.push(
71
+ `${color(BOX.v)}${" ".repeat(pad)}${options.title}${" ".repeat(Math.max(0, titlePad))}${color(BOX.v)}`
72
+ );
73
+ out.push(color(`${BOX.lt}${BOX.h.repeat(innerWidth)}${BOX.rt}`));
74
+ }
75
+ for (const line of lines) {
76
+ const lineLen = stripAnsi(line).length;
77
+ const linePad = innerWidth - lineLen - pad;
78
+ out.push(
79
+ `${color(BOX.v)}${" ".repeat(pad)}${line}${" ".repeat(Math.max(0, linePad))}${color(BOX.v)}`
80
+ );
81
+ }
82
+ out.push(color(`${BOX.bl}${BOX.h.repeat(innerWidth)}${BOX.br}`));
83
+ return out.join("\n");
84
+ }
85
+ function separator(width = 50) {
86
+ if (!isColorSupported) return BOX.h.repeat(width);
87
+ return dim(gray(BOX.h.repeat(width)));
88
+ }
89
+
90
+ // src/cli/utils/output.ts
91
+ var BANNER_ART = [
92
+ " ____ _ _ _ _ _ _______ ____ ",
93
+ " / ___| | / \\ | \\ | | |/ / ____| _ \\ ",
94
+ " | | | | / _ \\ | \\| | ' /| _| | |_) |",
95
+ " | |___| |___/ ___ \\| |\\ | . \\| |___| _ < ",
96
+ " \\____|_____/_/ \\_\\_| \\_|_|\\_\\_____|_| \\_\\"
97
+ ];
98
+ function getBanner(version) {
99
+ const lines = [""];
100
+ for (const line of BANNER_ART) {
101
+ lines.push(` ${gradient(line, BRAND_FROM, BRAND_TO)}`);
102
+ }
103
+ lines.push("");
104
+ lines.push(` ${dim(gray("Deploy tokens on the Superchain"))} ${dim(cyan(`v${version}`))}`);
105
+ lines.push(` ${separator(48)}`);
106
+ lines.push("");
107
+ return lines.join("\n");
108
+ }
109
+ function printBanner(version) {
110
+ console.log(getBanner(version));
111
+ }
112
+ function blockExplorerUrl(chain, hash, type = "tx") {
113
+ const explorer = chain.blockExplorers?.default?.url;
114
+ if (!explorer) return hash;
115
+ return `${explorer}/${type}/${hash}`;
116
+ }
117
+ function printResult(data, jsonMode) {
118
+ if (jsonMode) {
119
+ console.log(JSON.stringify(data, bigintReplacer, 2));
120
+ return;
121
+ }
122
+ const lines = Object.entries(data).map(([key, value]) => {
123
+ return `${cyan(key)} ${dim(BOX.v)} ${formatValue(value)}`;
124
+ });
125
+ console.log("");
126
+ console.log(drawBox(lines, { color: cyan }));
127
+ console.log("");
128
+ }
129
+ function printSuccess(message, jsonMode, data) {
130
+ if (jsonMode) {
131
+ console.log(JSON.stringify({ success: true, message, ...data }, bigintReplacer, 2));
132
+ return;
133
+ }
134
+ const title = `${green(bold(SYM.check))} ${green(bold(message))}`;
135
+ if (data) {
136
+ const lines = Object.entries(data).map(([key, value]) => {
137
+ return `${brightCyan(key)} ${dim(BOX.v)} ${formatValue(value)}`;
138
+ });
139
+ console.log("");
140
+ console.log(drawBox(lines, { title, color: green }));
141
+ console.log("");
142
+ } else {
143
+ console.log(`
144
+ ${title}
145
+ `);
146
+ }
147
+ }
148
+ function printError(error, jsonMode) {
149
+ const message = error instanceof Error ? error.message : String(error);
150
+ if (jsonMode) {
151
+ console.error(JSON.stringify({ success: false, error: message }));
152
+ return;
153
+ }
154
+ console.error(`
155
+ ${red(bold(SYM.cross))} ${red(bold("Error:"))} ${message}
156
+ `);
157
+ }
158
+ function printStep(message, jsonMode) {
159
+ if (jsonMode) return;
160
+ console.log(` ${cyan(SYM.arrow)} ${message}`);
161
+ }
162
+ function printInfo(label, value, jsonMode) {
163
+ if (jsonMode) return;
164
+ console.log(` ${dim(gray(SYM.dot))} ${dim(label)} ${value}`);
165
+ }
166
+ function printWarning(message, jsonMode) {
167
+ if (jsonMode) return;
168
+ console.log(` ${yellow(SYM.warn)} ${yellow(message)}`);
169
+ }
170
+ function printKeyValue(data, jsonMode, title) {
171
+ if (jsonMode) {
172
+ console.log(JSON.stringify(data, bigintReplacer, 2));
173
+ return;
174
+ }
175
+ const lines = [];
176
+ for (const [key, value] of Object.entries(data)) {
177
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
178
+ lines.push(bold(cyan(key)));
179
+ for (const [subKey, subVal] of Object.entries(value)) {
180
+ lines.push(` ${gray(subKey)} ${dim(BOX.v)} ${formatValue(subVal)}`);
181
+ }
182
+ } else {
183
+ lines.push(`${cyan(key)} ${dim(BOX.v)} ${formatValue(value)}`);
184
+ }
185
+ }
186
+ console.log("");
187
+ console.log(drawBox(lines, { color: cyan, title }));
188
+ console.log("");
189
+ }
190
+ function formatValue(value) {
191
+ if (typeof value === "bigint") return value.toString();
192
+ if (typeof value === "object" && value !== null) return JSON.stringify(value, bigintReplacer);
193
+ return String(value);
194
+ }
195
+ function bigintReplacer(_key, value) {
196
+ return typeof value === "bigint" ? value.toString() : value;
197
+ }
198
+ export {
199
+ blockExplorerUrl,
200
+ getBanner,
201
+ printBanner,
202
+ printError,
203
+ printInfo,
204
+ printKeyValue,
205
+ printResult,
206
+ printStep,
207
+ printSuccess,
208
+ printWarning
209
+ };
@@ -0,0 +1,49 @@
1
+ declare const bold: (s: string) => string;
2
+ declare const dim: (s: string) => string;
3
+ declare const italic: (s: string) => string;
4
+ declare const underline: (s: string) => string;
5
+ declare const red: (s: string) => string;
6
+ declare const green: (s: string) => string;
7
+ declare const yellow: (s: string) => string;
8
+ declare const blue: (s: string) => string;
9
+ declare const magenta: (s: string) => string;
10
+ declare const cyan: (s: string) => string;
11
+ declare const white: (s: string) => string;
12
+ declare const gray: (s: string) => string;
13
+ declare const brightCyan: (s: string) => string;
14
+ declare const brightGreen: (s: string) => string;
15
+ declare const brightMagenta: (s: string) => string;
16
+ declare function rgb(r: number, g: number, b: number, text: string): string;
17
+ declare function gradient(text: string, from: [number, number, number], to: [number, number, number]): string;
18
+ declare const BRAND_FROM: [number, number, number];
19
+ declare const BRAND_TO: [number, number, number];
20
+ declare function brandGradient(text: string): string;
21
+ declare const SYM: {
22
+ readonly check: "✔" | "+";
23
+ readonly cross: "✖" | "x";
24
+ readonly arrow: "▸" | ">";
25
+ readonly dot: "●" | "*";
26
+ readonly star: "*" | "★";
27
+ readonly info: "i" | "ℹ";
28
+ readonly warn: "⚠" | "!";
29
+ readonly rocket: "🚀" | "^";
30
+ };
31
+ declare const BOX: {
32
+ readonly tl: "╭";
33
+ readonly tr: "╮";
34
+ readonly bl: "╰";
35
+ readonly br: "╯";
36
+ readonly h: "─";
37
+ readonly v: "│";
38
+ readonly lt: "├";
39
+ readonly rt: "┤";
40
+ };
41
+ declare function stripAnsi(str: string): string;
42
+ declare function drawBox(lines: string[], options?: {
43
+ title?: string;
44
+ color?: (s: string) => string;
45
+ padding?: number;
46
+ }): string;
47
+ declare function separator(width?: number): string;
48
+
49
+ export { BOX, BRAND_FROM, BRAND_TO, SYM, blue, bold, brandGradient, brightCyan, brightGreen, brightMagenta, cyan, dim, drawBox, gradient, gray, green, italic, magenta, red, rgb, separator, stripAnsi, underline, white, yellow };
@@ -0,0 +1,129 @@
1
+ // src/cli/utils/style.ts
2
+ var isColorSupported = process.env.NO_COLOR === void 0 && process.env.FORCE_COLOR !== "0" && process.env.TERM !== "dumb" && (process.env.FORCE_COLOR !== void 0 || process.stdout.isTTY === true);
3
+ var ESC = "\x1B[";
4
+ var RST = `${ESC}0m`;
5
+ function wrap(code, text) {
6
+ if (!isColorSupported) return text;
7
+ return `${ESC}${code}m${text}${RST}`;
8
+ }
9
+ var bold = (s) => wrap("1", s);
10
+ var dim = (s) => wrap("2", s);
11
+ var italic = (s) => wrap("3", s);
12
+ var underline = (s) => wrap("4", s);
13
+ var red = (s) => wrap("31", s);
14
+ var green = (s) => wrap("32", s);
15
+ var yellow = (s) => wrap("33", s);
16
+ var blue = (s) => wrap("34", s);
17
+ var magenta = (s) => wrap("35", s);
18
+ var cyan = (s) => wrap("36", s);
19
+ var white = (s) => wrap("37", s);
20
+ var gray = (s) => wrap("90", s);
21
+ var brightCyan = (s) => wrap("96", s);
22
+ var brightGreen = (s) => wrap("92", s);
23
+ var brightMagenta = (s) => wrap("95", s);
24
+ function rgb(r, g, b, text) {
25
+ if (!isColorSupported) return text;
26
+ return `${ESC}38;2;${r};${g};${b}m${text}${RST}`;
27
+ }
28
+ function gradient(text, from, to) {
29
+ if (!isColorSupported) return text;
30
+ const chars = [...text];
31
+ const total = chars.length;
32
+ if (total === 0) return "";
33
+ return chars.map((ch, i) => {
34
+ if (ch === " ") return ch;
35
+ const t = total > 1 ? i / (total - 1) : 0;
36
+ const r = Math.round(from[0] + (to[0] - from[0]) * t);
37
+ const g = Math.round(from[1] + (to[1] - from[1]) * t);
38
+ const b = Math.round(from[2] + (to[2] - from[2]) * t);
39
+ return `${ESC}38;2;${r};${g};${b}m${ch}`;
40
+ }).join("") + RST;
41
+ }
42
+ var BRAND_FROM = [6, 182, 212];
43
+ var BRAND_TO = [168, 85, 247];
44
+ function brandGradient(text) {
45
+ return gradient(text, BRAND_FROM, BRAND_TO);
46
+ }
47
+ var SYM = {
48
+ check: isColorSupported ? "\u2714" : "+",
49
+ cross: isColorSupported ? "\u2716" : "x",
50
+ arrow: isColorSupported ? "\u25B8" : ">",
51
+ dot: isColorSupported ? "\u25CF" : "*",
52
+ star: isColorSupported ? "\u2605" : "*",
53
+ info: isColorSupported ? "\u2139" : "i",
54
+ warn: isColorSupported ? "\u26A0" : "!",
55
+ rocket: isColorSupported ? "\u{1F680}" : "^"
56
+ };
57
+ var BOX = {
58
+ tl: "\u256D",
59
+ tr: "\u256E",
60
+ bl: "\u2570",
61
+ br: "\u256F",
62
+ h: "\u2500",
63
+ v: "\u2502",
64
+ lt: "\u251C",
65
+ rt: "\u2524"
66
+ };
67
+ function stripAnsi(str) {
68
+ return str.replace(/\x1b\[[0-9;]*m/g, "");
69
+ }
70
+ function drawBox(lines, options) {
71
+ const color = options?.color || cyan;
72
+ const pad = options?.padding ?? 1;
73
+ const contentWidth = Math.max(
74
+ ...lines.map((l) => stripAnsi(l).length),
75
+ options?.title ? stripAnsi(options.title).length : 0,
76
+ 20
77
+ );
78
+ const innerWidth = contentWidth + pad * 2;
79
+ const out = [];
80
+ out.push(color(`${BOX.tl}${BOX.h.repeat(innerWidth)}${BOX.tr}`));
81
+ if (options?.title) {
82
+ const titleLen = stripAnsi(options.title).length;
83
+ const titlePad = innerWidth - titleLen - pad;
84
+ out.push(
85
+ `${color(BOX.v)}${" ".repeat(pad)}${options.title}${" ".repeat(Math.max(0, titlePad))}${color(BOX.v)}`
86
+ );
87
+ out.push(color(`${BOX.lt}${BOX.h.repeat(innerWidth)}${BOX.rt}`));
88
+ }
89
+ for (const line of lines) {
90
+ const lineLen = stripAnsi(line).length;
91
+ const linePad = innerWidth - lineLen - pad;
92
+ out.push(
93
+ `${color(BOX.v)}${" ".repeat(pad)}${line}${" ".repeat(Math.max(0, linePad))}${color(BOX.v)}`
94
+ );
95
+ }
96
+ out.push(color(`${BOX.bl}${BOX.h.repeat(innerWidth)}${BOX.br}`));
97
+ return out.join("\n");
98
+ }
99
+ function separator(width = 50) {
100
+ if (!isColorSupported) return BOX.h.repeat(width);
101
+ return dim(gray(BOX.h.repeat(width)));
102
+ }
103
+ export {
104
+ BOX,
105
+ BRAND_FROM,
106
+ BRAND_TO,
107
+ SYM,
108
+ blue,
109
+ bold,
110
+ brandGradient,
111
+ brightCyan,
112
+ brightGreen,
113
+ brightMagenta,
114
+ cyan,
115
+ dim,
116
+ drawBox,
117
+ gradient,
118
+ gray,
119
+ green,
120
+ italic,
121
+ magenta,
122
+ red,
123
+ rgb,
124
+ separator,
125
+ stripAnsi,
126
+ underline,
127
+ white,
128
+ yellow
129
+ };
@@ -0,0 +1,22 @@
1
+ import { Chain, WalletClient, Transport, Account, PublicClient } from 'viem';
2
+ import { privateKeyToAccount } from 'viem/accounts';
3
+
4
+ interface GlobalOpts {
5
+ chain?: string;
6
+ rpc?: string;
7
+ privateKey?: string;
8
+ json?: boolean;
9
+ dryRun?: boolean;
10
+ }
11
+ declare function resolveClients(opts: GlobalOpts): {
12
+ chain: Chain;
13
+ account: ReturnType<typeof privateKeyToAccount>;
14
+ walletClient: WalletClient<Transport, Chain, Account>;
15
+ publicClient: PublicClient;
16
+ };
17
+ declare function resolvePublicClient(opts: GlobalOpts): {
18
+ chain: Chain;
19
+ publicClient: PublicClient;
20
+ };
21
+
22
+ export { type GlobalOpts, resolveClients, resolvePublicClient };