@strkfarm/sdk 2.0.0-staging.4 → 2.0.0-staging.41

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.
@@ -11,8 +11,12 @@ const colors = {
11
11
  // Add custom colors to Winston
12
12
  winston.addColors(colors);
13
13
 
14
+ // Get log level from environment variable, default to "warn" to only show warn and error
15
+ // Valid levels: error, warn, info, verbose, debug
16
+ const logLevel = (process.env.LOG_LEVEL || process.env.SDK_LOG_LEVEL || "debug").toLowerCase();
17
+
14
18
  export const logger = winston.createLogger({
15
- level: "debug", // Set the minimum logging level
19
+ level: logLevel, // Set the minimum logging level from environment variable
16
20
  format: format.combine(
17
21
  format.colorize({ all: true }), // Apply custom colors
18
22
  format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), // Add timestamp to log messages
@@ -20,9 +24,12 @@ export const logger = winston.createLogger({
20
24
  let msg = `${timestamp} ${level}: ${message}`;
21
25
  // Print stack trace if error is passed
22
26
  if (meta && meta[Symbol.for("splat")]) {
23
- for (const arg of meta[Symbol.for("splat")]) {
24
- if (arg instanceof Error) {
25
- msg += `\n${arg.stack}`;
27
+ const splat = meta[Symbol.for("splat")] as unknown[];
28
+ if (Array.isArray(splat)) {
29
+ for (const arg of splat) {
30
+ if (arg instanceof Error) {
31
+ msg += `\n${arg.stack}`;
32
+ }
26
33
  }
27
34
  }
28
35
  }
@@ -1,7 +1,11 @@
1
1
  import { SingleTokenInfo, DualTokenInfo } from "../strategies/base-strategy";
2
2
  import { BaseStrategy } from "../strategies/base-strategy";
3
3
  import { AmountsInfo, StrategyCapabilities, TokenInfo } from "@/interfaces";
4
- import { Web3Number } from "@/dataTypes";
4
+ import { ContractAddr, Web3Number } from "@/dataTypes";
5
+ import { gql } from "@apollo/client";
6
+ import apolloClient from "@/modules/apollo-client";
7
+ import { num } from "starknet";
8
+ import { logger } from "./logger";
5
9
 
6
10
  /**
7
11
  * Convert SDK TVL info (SingleTokenInfo or DualTokenInfo) to client AmountsInfo format
@@ -54,4 +58,4 @@ export function detectCapabilities(
54
58
  export function isDualTokenStrategy(strategy: BaseStrategy<any, any>): boolean {
55
59
  // Check if strategy has matchInputAmounts (dual token strategies have this)
56
60
  return typeof (strategy as any).matchInputAmounts === "function";
57
- }
61
+ }