torch-liquidation-bot 3.0.0 → 3.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "torch-liquidation-bot",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "autonomous vault-based liquidation keeper for Torch Market lending on Solana using torchsdk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -1,8 +1,8 @@
1
- # torch-liquidation-bot v3.0.0 (Vault Mode)
1
+ # torch-liquidation-bot v3.0.2 (Vault Mode)
2
2
 
3
3
  Vault-based liquidation bot for [Torch Market](https://torch.market) on Solana. Generates an agent keypair in-process — no user wallet required. All operations route through a Torch Vault.
4
4
 
5
- > **v3.0.0 Breaking Change:** The bot now operates through the torchsdk v2.1.0 vault model. It generates a disposable agent keypair at startup, scans for underwater loan positions, and executes liquidations. The user never provides a wallet — only a vault creator pubkey and an RPC endpoint.
5
+ > **v3.0.0+ Breaking Change:** The bot now operates through the torchsdk v3.2.3+ vault model. It generates a disposable agent keypair at startup, scans for underwater loan positions, and executes liquidations. The user never provides a wallet — only a vault creator pubkey and an RPC endpoint.
6
6
 
7
7
  ## Install
8
8
 
@@ -14,7 +14,7 @@ npm install torch-liquidation-bot
14
14
 
15
15
  ```bash
16
16
  # 1. start the bot — it prints its agent wallet on startup
17
- VAULT_CREATOR=<your-vault-creator-pubkey> RPC_URL=<rpc> npx torch-liquidation-bot
17
+ VAULT_CREATOR=<your-vault-creator-pubkey> SOLANA_RPC_URL=<rpc> npx torch-liquidation-bot
18
18
 
19
19
  # 2. link the printed agent wallet to your vault (one-time, from your authority wallet)
20
20
  # the bot will print the exact instructions if the wallet is not yet linked
@@ -42,14 +42,15 @@ All value flows through the vault. The agent wallet is a stateless controller.
42
42
 
43
43
  | Variable | Required | Default | Description |
44
44
  |----------|----------|---------|-------------|
45
- | `RPC_URL` | yes | -- | Solana RPC endpoint |
45
+ | `SOLANA_RPC_URL` | yes | -- | Solana RPC endpoint (fallback: `RPC_URL`) |
46
46
  | `VAULT_CREATOR` | yes | -- | Vault creator pubkey (identifies which vault to use) |
47
+ | `SOLANA_PRIVATE_KEY` | no | -- | Disposable controller keypair (base58 or JSON byte array). If omitted, generates fresh keypair on startup |
47
48
  | `SCAN_INTERVAL_MS` | no | `30000` | Milliseconds between scan cycles (min 5000) |
48
49
  | `LOG_LEVEL` | no | `info` | `debug`, `info`, `warn`, `error` |
49
50
 
50
51
  ## Vault Setup
51
52
 
52
- The bot uses the torchsdk v2.1.0 vault model:
53
+ The bot uses the torchsdk v3.2.3 vault model:
53
54
 
54
55
  ```
55
56
  User (hardware wallet) → Creates vault, deposits SOL
@@ -81,7 +82,8 @@ const connection = new Connection('<rpc>', 'confirmed')
81
82
  const agent = Keypair.generate()
82
83
 
83
84
  // verify vault and link
84
- const vault = await getVault(connection, '<vault-creator-pubkey>')
85
+ const vaultCreator = '<vault-creator-pubkey>'
86
+ const vault = await getVault(connection, vaultCreator)
85
87
  const link = await getVaultForWallet(connection, agent.publicKey.toBase58())
86
88
 
87
89
  // scan and liquidate
@@ -100,6 +102,7 @@ for (const token of tokens) {
100
102
  mint: token.mint,
101
103
  liquidator: agent.publicKey.toBase58(),
102
104
  borrower: holder.address,
105
+ vault: vaultCreator,
103
106
  })
104
107
  transaction.sign(agent)
105
108
  const sig = await connection.sendRawTransaction(transaction.serialize())
@@ -113,7 +116,7 @@ for (const token of tokens) {
113
116
  ```
114
117
  src/
115
118
  ├── types.ts — BotConfig interface
116
- ├── config.ts — loadConfig() (RPC_URL, VAULT_CREATOR, SCAN_INTERVAL_MS, LOG_LEVEL)
119
+ ├── config.ts — loadConfig() (SOLANA_RPC_URL, VAULT_CREATOR, SOLANA_PRIVATE_KEY, SCAN_INTERVAL_MS, LOG_LEVEL)
117
120
  ├── utils.ts — sol(), bpsToPercent(), createLogger()
118
121
  └── index.ts — vault-based liquidation loop
119
122
  ```
@@ -139,19 +142,31 @@ pnpm test
139
142
 
140
143
  ## Security
141
144
 
142
- - Agent keypair generated in-process never serialized, never leaves the process
143
- - No user wallet or private key imported from environment
145
+ - Agent keypair generated in-process with `Keypair.generate()` (or loaded from optional `SOLANA_PRIVATE_KEY`)
144
146
  - Vault model: agent is a stateless controller, all value stays in the vault
145
147
  - Authority can unlink the agent wallet instantly via `buildUnlinkWalletTransaction()`
146
- - Outbound connections: Solana RPC only
147
- - Minimal dependencies: `@solana/web3.js` + `torchsdk`
148
+ - Minimal dependencies: `@solana/web3.js` + `torchsdk` -- both pinned to exact versions
148
149
  - No post-install hooks, no remote code fetching
150
+ - `disable-model-invocation: true` -- agents cannot invoke this skill autonomously
151
+
152
+ ### External Runtime Dependencies
153
+
154
+ The SDK makes outbound HTTPS requests to two external services at runtime (the bot does **not** contact SAID Protocol):
155
+
156
+ | Service | Purpose | When Called |
157
+ |---------|---------|------------|
158
+ | **CoinGecko** (`api.coingecko.com`) | SOL/USD price for display | Token queries via `getTokens()` |
159
+ | **Irys Gateway** (`gateway.irys.xyz`) | Token metadata fallback (name, symbol, image) | `getTokens()` when on-chain metadata URI points to Irys |
160
+
161
+ `confirmTransaction()` does NOT contact SAID — it only calls `connection.getParsedTransaction()` (Solana RPC). The SDK exports a `verifySaid()` function that contacts `api.saidprotocol.com`, but the bot never calls it.
162
+
163
+ No credentials are sent to any external service. All requests are read-only GET. No private key material is ever transmitted.
149
164
 
150
165
  ## Links
151
166
 
152
167
  - [torchsdk](https://github.com/mrsirg97-rgb/torchsdk) -- the SDK powering this bot
153
168
  - [Torch Market](https://torch.market) -- the protocol
154
- - [ClawHub](https://clawhub.ai/mrsirg97-rgb/torchliquidationbot) -- skill registry
169
+ - [ClawHub](https://clawhub.ai/mrsirg97-rgb/torch-liquidation-bot) -- skill registry
155
170
 
156
171
  ## License
157
172
 
package/dist/config.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * config.ts — loads environment variables into a typed BotConfig.
3
- *
4
- * the agent keypair is generated in-process. the user never provides a wallet.
5
- * VAULT_CREATOR identifies which vault the bot operates through.
6
- */
7
- import type { BotConfig } from './types';
8
- export declare const loadConfig: () => BotConfig;
9
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,SAAS,CAAA;AAIlD,eAAO,MAAM,UAAU,QAAO,SAkB7B,CAAA"}
package/dist/config.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- /**
3
- * config.ts — loads environment variables into a typed BotConfig.
4
- *
5
- * the agent keypair is generated in-process. the user never provides a wallet.
6
- * VAULT_CREATOR identifies which vault the bot operates through.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.loadConfig = void 0;
10
- const LOG_LEVELS = ['debug', 'info', 'warn', 'error'];
11
- const loadConfig = () => {
12
- const rpcUrl = process.env.RPC_URL;
13
- if (!rpcUrl)
14
- throw new Error('RPC_URL env var is required');
15
- const vaultCreator = process.env.VAULT_CREATOR;
16
- if (!vaultCreator)
17
- throw new Error('VAULT_CREATOR env var is required (vault creator pubkey)');
18
- const scanIntervalMs = parseInt(process.env.SCAN_INTERVAL_MS ?? '30000', 10);
19
- if (isNaN(scanIntervalMs) || scanIntervalMs < 5000) {
20
- throw new Error('SCAN_INTERVAL_MS must be a number >= 5000');
21
- }
22
- const logLevel = (process.env.LOG_LEVEL ?? 'info');
23
- if (!LOG_LEVELS.includes(logLevel)) {
24
- throw new Error(`LOG_LEVEL must be one of: ${LOG_LEVELS.join(', ')}`);
25
- }
26
- return { rpcUrl, vaultCreator, scanIntervalMs, logLevel };
27
- };
28
- exports.loadConfig = loadConfig;
29
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH,MAAM,UAAU,GAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AAE1D,MAAM,UAAU,GAAG,GAAc,EAAE;IACxC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA;IAClC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAE3D,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAA;IAC9C,IAAI,CAAC,YAAY;QAAE,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;IAE9F,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,OAAO,EAAE,EAAE,CAAC,CAAA;IAC5E,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,cAAc,GAAG,IAAI,EAAE,CAAC;QACnD,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;IAC9D,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM,CAAa,CAAA;IAC9D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,6BAA6B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACvE,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAA;AAC3D,CAAC,CAAA;AAlBY,QAAA,UAAU,cAkBtB"}
package/dist/index.d.ts DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * torch-liquidation-bot — vault-based liquidation bot.
4
- *
5
- * generates an agent keypair in-process. all operations route through
6
- * a torch vault identified by VAULT_CREATOR. the user never provides a wallet.
7
- *
8
- * usage:
9
- * VAULT_CREATOR=<pubkey> RPC_URL=<rpc> npx tsx src/index.ts
10
- *
11
- * env:
12
- * RPC_URL — solana RPC endpoint (required)
13
- * VAULT_CREATOR — vault creator pubkey (required)
14
- * SCAN_INTERVAL_MS — ms between scan cycles (default 30000, min 5000)
15
- * LOG_LEVEL — debug | info | warn | error (default info)
16
- */
17
- export {};
18
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG"}
package/dist/index.js DELETED
@@ -1,150 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * torch-liquidation-bot — vault-based liquidation bot.
5
- *
6
- * generates an agent keypair in-process. all operations route through
7
- * a torch vault identified by VAULT_CREATOR. the user never provides a wallet.
8
- *
9
- * usage:
10
- * VAULT_CREATOR=<pubkey> RPC_URL=<rpc> npx tsx src/index.ts
11
- *
12
- * env:
13
- * RPC_URL — solana RPC endpoint (required)
14
- * VAULT_CREATOR — vault creator pubkey (required)
15
- * SCAN_INTERVAL_MS — ms between scan cycles (default 30000, min 5000)
16
- * LOG_LEVEL — debug | info | warn | error (default info)
17
- */
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- const web3_js_1 = require("@solana/web3.js");
20
- const torchsdk_1 = require("torchsdk");
21
- const config_1 = require("./config");
22
- const utils_1 = require("./utils");
23
- // ---------------------------------------------------------------------------
24
- // bootstrap — generate agent keypair in-process
25
- // ---------------------------------------------------------------------------
26
- const agentKeypair = web3_js_1.Keypair.generate();
27
- // ---------------------------------------------------------------------------
28
- // scan & liquidate
29
- // ---------------------------------------------------------------------------
30
- const scanAndLiquidate = async (connection, log, vaultCreator) => {
31
- const { tokens } = await (0, torchsdk_1.getTokens)(connection, {
32
- status: 'migrated',
33
- sort: 'volume',
34
- limit: 50,
35
- });
36
- log('debug', `discovered ${tokens.length} migrated tokens`);
37
- for (const token of tokens) {
38
- let lending;
39
- try {
40
- lending = await (0, torchsdk_1.getLendingInfo)(connection, token.mint);
41
- }
42
- catch {
43
- continue; // lending not enabled for this token
44
- }
45
- if (!lending.active_loans || lending.active_loans === 0)
46
- continue;
47
- log('debug', `${token.symbol} — ${lending.active_loans} active loans, ` +
48
- `threshold: ${(0, utils_1.bpsToPercent)(lending.liquidation_threshold_bps)}, ` +
49
- `bonus: ${(0, utils_1.bpsToPercent)(lending.liquidation_bonus_bps)}`);
50
- // get holders as potential borrowers
51
- let holders;
52
- try {
53
- const result = await (0, torchsdk_1.getHolders)(connection, token.mint);
54
- holders = result.holders;
55
- }
56
- catch {
57
- log('debug', `${token.symbol} — could not fetch holders, skipping`);
58
- continue;
59
- }
60
- for (const holder of holders) {
61
- let position;
62
- try {
63
- position = await (0, torchsdk_1.getLoanPosition)(connection, token.mint, holder.address);
64
- }
65
- catch {
66
- continue; // no loan position for this holder
67
- }
68
- // SDK provides health status directly — skip non-liquidatable positions
69
- if (position.health !== 'liquidatable')
70
- continue;
71
- log('info', `LIQUIDATABLE | ${token.symbol} | borrower=${holder.address.slice(0, 8)}... | ` +
72
- `LTV=${position.current_ltv_bps != null ? (0, utils_1.bpsToPercent)(position.current_ltv_bps) : '?'} > ` +
73
- `threshold=${(0, utils_1.bpsToPercent)(lending.liquidation_threshold_bps)} | ` +
74
- `owed=${(0, utils_1.sol)(position.total_owed)} SOL`);
75
- // build and execute liquidation through the vault
76
- try {
77
- const { transaction, message } = await (0, torchsdk_1.buildLiquidateTransaction)(connection, {
78
- mint: token.mint,
79
- liquidator: agentKeypair.publicKey.toBase58(),
80
- borrower: holder.address,
81
- vault: vaultCreator,
82
- });
83
- transaction.sign(agentKeypair);
84
- const signature = await connection.sendRawTransaction(transaction.serialize());
85
- await (0, torchsdk_1.confirmTransaction)(connection, signature, agentKeypair.publicKey.toBase58());
86
- log('info', `LIQUIDATED | ${token.symbol} | borrower=${holder.address.slice(0, 8)}... | ` +
87
- `sig=${signature.slice(0, 16)}... | ${message}`);
88
- }
89
- catch (err) {
90
- log('warn', `LIQUIDATION FAILED | ${token.symbol} | ${holder.address.slice(0, 8)}... | ${err.message}`);
91
- }
92
- }
93
- }
94
- };
95
- // ---------------------------------------------------------------------------
96
- // main — vault-routed liquidation loop
97
- // ---------------------------------------------------------------------------
98
- const main = async () => {
99
- const config = (0, config_1.loadConfig)();
100
- const log = (0, utils_1.createLogger)(config.logLevel);
101
- const connection = new web3_js_1.Connection(config.rpcUrl, 'confirmed');
102
- console.log('=== torch liquidation bot ===');
103
- console.log(`agent wallet: ${agentKeypair.publicKey.toBase58()}`);
104
- console.log(`vault creator: ${config.vaultCreator}`);
105
- console.log(`scan interval: ${config.scanIntervalMs}ms`);
106
- console.log();
107
- // verify vault exists
108
- const vault = await (0, torchsdk_1.getVault)(connection, config.vaultCreator);
109
- if (!vault) {
110
- throw new Error(`vault not found for creator ${config.vaultCreator}`);
111
- }
112
- log('info', `vault found — authority=${vault.authority}`);
113
- // verify agent wallet is linked to vault
114
- const link = await (0, torchsdk_1.getVaultForWallet)(connection, agentKeypair.publicKey.toBase58());
115
- if (!link) {
116
- console.log();
117
- console.log('--- ACTION REQUIRED ---');
118
- console.log('agent wallet is NOT linked to the vault.');
119
- console.log('link it by running (from your authority wallet):');
120
- console.log();
121
- console.log(` buildLinkWalletTransaction(connection, {`);
122
- console.log(` authority: "<your-authority-pubkey>",`);
123
- console.log(` vault_creator: "${config.vaultCreator}",`);
124
- console.log(` wallet_to_link: "${agentKeypair.publicKey.toBase58()}"`);
125
- console.log(` })`);
126
- console.log();
127
- console.log('then restart the bot.');
128
- console.log('-----------------------');
129
- process.exit(1);
130
- }
131
- log('info', 'agent wallet linked to vault — starting scan loop');
132
- log('info', `treasury: ${(0, utils_1.sol)(vault.sol_balance ?? 0)} SOL`);
133
- // scan loop
134
- while (true) {
135
- try {
136
- log('debug', '--- scan cycle start ---');
137
- await scanAndLiquidate(connection, log, config.vaultCreator);
138
- log('debug', '--- scan cycle end ---');
139
- }
140
- catch (err) {
141
- log('error', `scan cycle error: ${err.message}`);
142
- }
143
- await new Promise((resolve) => setTimeout(resolve, config.scanIntervalMs));
144
- }
145
- };
146
- main().catch((err) => {
147
- console.error('FATAL:', err.message ?? err);
148
- process.exit(1);
149
- });
150
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;GAcG;;AAEH,6CAAqD;AACrD,uCAWiB;AACjB,qCAAqC;AACrC,mCAAyD;AAEzD,8EAA8E;AAC9E,gDAAgD;AAChD,8EAA8E;AAE9E,MAAM,YAAY,GAAG,iBAAO,CAAC,QAAQ,EAAE,CAAA;AAEvC,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,gBAAgB,GAAG,KAAK,EAC5B,UAAsB,EACtB,GAAoC,EACpC,YAAoB,EACpB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,oBAAS,EAAC,UAAU,EAAE;QAC7C,MAAM,EAAE,UAAU;QAClB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,EAAE;KACV,CAAC,CAAA;IAEF,GAAG,CAAC,OAAO,EAAE,cAAc,MAAM,CAAC,MAAM,kBAAkB,CAAC,CAAA;IAE3D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,OAAoB,CAAA;QACxB,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,IAAA,yBAAc,EAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;QACxD,CAAC;QAAC,MAAM,CAAC;YACP,SAAQ,CAAC,qCAAqC;QAChD,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,KAAK,CAAC;YAAE,SAAQ;QAEjE,GAAG,CACD,OAAO,EACP,GAAG,KAAK,C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,CAAC,CAAA;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
package/dist/types.d.ts DELETED
@@ -1,11 +0,0 @@
1
- /**
2
- * types.ts — interfaces for the vault-based liquidation bot.
3
- */
4
- export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
5
- export interface BotConfig {
6
- rpcUrl: string;
7
- vaultCreator: string;
8
- scanIntervalMs: number;
9
- logLevel: LogLevel;
10
- }
11
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE1D,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,QAAQ,CAAA;CACnB"}
package/dist/types.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- /**
3
- * types.ts — interfaces for the vault-based liquidation bot.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/dist/utils.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * utils.ts — shared helpers.
3
- */
4
- import type { LogLevel } from './types';
5
- export declare const sol: (lamports: number) => string;
6
- export declare const bpsToPercent: (bps: number) => string;
7
- export declare function createLogger(minLevel: LogLevel): (level: LogLevel, msg: string) => void;
8
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,eAAO,MAAM,GAAG,GAAI,UAAU,MAAM,WAA6C,CAAA;AAEjF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,WAAiC,CAAA;AAIzE,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,IAGzB,OAAO,QAAQ,EAAE,KAAK,MAAM,UAMjD"}
package/dist/utils.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- /**
3
- * utils.ts — shared helpers.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.bpsToPercent = exports.sol = void 0;
7
- exports.createLogger = createLogger;
8
- const torchsdk_1 = require("torchsdk");
9
- const sol = (lamports) => (lamports / torchsdk_1.LAMPORTS_PER_SOL).toFixed(4);
10
- exports.sol = sol;
11
- const bpsToPercent = (bps) => (bps / 100).toFixed(2) + '%';
12
- exports.bpsToPercent = bpsToPercent;
13
- const LEVEL_ORDER = ['debug', 'info', 'warn', 'error'];
14
- function createLogger(minLevel) {
15
- const minIdx = LEVEL_ORDER.indexOf(minLevel);
16
- return function log(level, msg) {
17
- if (LEVEL_ORDER.indexOf(level) < minIdx)
18
- return;
19
- const ts = new Date().toISOString().substr(11, 12);
20
- const tag = level.toUpperCase().padEnd(5);
21
- console.log(`[${ts}] ${tag} ${msg}`);
22
- };
23
- }
24
- //# sourceMappingURL=utils.js.map
package/dist/utils.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAWH,oCASC;AAlBD,uCAA2C;AAGpC,MAAM,GAAG,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,QAAQ,GAAG,2BAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAApE,QAAA,GAAG,OAAiE;AAE1E,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;AAA5D,QAAA,YAAY,gBAAgD;AAEzE,MAAM,WAAW,GAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AAElE,SAAgB,YAAY,CAAC,QAAkB;IAC7C,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAE5C,OAAO,SAAS,GAAG,CAAC,KAAe,EAAE,GAAW;QAC9C,IAAI,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM;YAAE,OAAM;QAC/C,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;QAClD,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACzC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC,CAAA;IACtC,CAAC,CAAA;AACH,CAAC"}