@augustdigital/sdk 8.2.0 → 8.3.1

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.
@@ -8,7 +8,7 @@ export declare const STELLAR_CHAIN: {
8
8
  export declare const SOROBAN_RPC_URLS: Record<IStellarNetwork, string>;
9
9
  export declare const NETWORK_PASSPHRASES: Record<IStellarNetwork, string>;
10
10
  export declare const STELLAR_FALLBACK_DECIMALS = 7;
11
- export declare const TX_TIMEOUT_SECONDS = 120;
11
+ export declare const TX_TIMEOUT_SECONDS = 600;
12
12
  export declare const QUERY_TIMEOUT_SECONDS = 10;
13
13
  export declare const MAX_FEE_STROOPS = "1000000";
14
14
  export declare const POLL_INTERVAL_MS = 2000;
@@ -14,7 +14,7 @@ exports.NETWORK_PASSPHRASES = {
14
14
  testnet: stellar_sdk_1.Networks.TESTNET,
15
15
  };
16
16
  exports.STELLAR_FALLBACK_DECIMALS = 7;
17
- exports.TX_TIMEOUT_SECONDS = 120;
17
+ exports.TX_TIMEOUT_SECONDS = 600;
18
18
  exports.QUERY_TIMEOUT_SECONDS = 10;
19
19
  exports.MAX_FEE_STROOPS = '1000000';
20
20
  exports.POLL_INTERVAL_MS = 2000;
@@ -1,4 +1,4 @@
1
- import { ITokenizedVault, IVault } from '../../types';
1
+ import type { ITokenizedVault, IVault } from '../../types';
2
2
  import type { IVaultBaseOptions } from '../../modules/vaults/types';
3
3
  import type { IStellarNetwork, IStellarUserPosition } from './types';
4
4
  export declare const getStellarVault: (tokenizedVault: ITokenizedVault, _options: IVaultBaseOptions) => Promise<IVault>;
@@ -6,16 +6,16 @@ const core_1 = require("../../core");
6
6
  const utils_1 = require("../../modules/vaults/utils");
7
7
  const constants_1 = require("./constants");
8
8
  const soroban_1 = require("./soroban");
9
- function parseDecimalsOrFallback(scVal, context, vaultAddress) {
9
+ function parseDecimals(scVal, context, vaultAddress) {
10
10
  if (!scVal) {
11
11
  core_1.Logger.log.error(context, 'Decimals not available — using fallback (financial values may be incorrect)', {
12
12
  vault: vaultAddress,
13
13
  fallbackDecimals: constants_1.STELLAR_FALLBACK_DECIMALS,
14
14
  });
15
- return constants_1.STELLAR_FALLBACK_DECIMALS;
15
+ return { decimals: constants_1.STELLAR_FALLBACK_DECIMALS, fromFallback: true };
16
16
  }
17
17
  try {
18
- return Number((0, stellar_sdk_1.scValToBigInt)(scVal));
18
+ return { decimals: Number((0, stellar_sdk_1.scValToBigInt)(scVal)), fromFallback: false };
19
19
  }
20
20
  catch (parseErr) {
21
21
  core_1.Logger.log.error(context, 'Failed to parse decimals from Soroban — using fallback (financial values may be incorrect)', {
@@ -23,9 +23,12 @@ function parseDecimalsOrFallback(scVal, context, vaultAddress) {
23
23
  fallbackDecimals: constants_1.STELLAR_FALLBACK_DECIMALS,
24
24
  error: String(parseErr),
25
25
  });
26
- return constants_1.STELLAR_FALLBACK_DECIMALS;
26
+ return { decimals: constants_1.STELLAR_FALLBACK_DECIMALS, fromFallback: true };
27
27
  }
28
28
  }
29
+ function parseDecimalsOrFallback(scVal, context, vaultAddress) {
30
+ return parseDecimals(scVal, context, vaultAddress).decimals;
31
+ }
29
32
  function resolveNetwork(tokenizedVault) {
30
33
  const meta = tokenizedVault.stellar_vault_metadata;
31
34
  const networkName = meta?.network_name;
@@ -125,7 +128,7 @@ const getStellarUserPosition = async (vaultAddress, walletAddress, network = 'ma
125
128
  (0, soroban_1.queryContract)(config, vaultAddress, 'balance', [userAddress.toScVal()]),
126
129
  (0, soroban_1.queryContract)(config, vaultAddress, 'decimals'),
127
130
  ]);
128
- const decimals = parseDecimalsOrFallback(decimalsResult, 'getStellarUserPosition', vaultAddress);
131
+ const { decimals, fromFallback: decimalsFromFallback } = parseDecimals(decimalsResult, 'getStellarUserPosition', vaultAddress);
129
132
  if (!balanceResult) {
130
133
  core_1.Logger.log.warn('getStellarUserPosition', 'Balance query returned null', {
131
134
  vault: vaultAddress,
@@ -148,6 +151,7 @@ const getStellarUserPosition = async (vaultAddress, walletAddress, network = 'ma
148
151
  return {
149
152
  shares: rawBalance.toString(),
150
153
  decimals,
154
+ decimalsFromFallback,
151
155
  };
152
156
  }
153
157
  catch (err) {
@@ -2,7 +2,7 @@ import * as StellarConstants from './constants';
2
2
  import * as StellarGetters from './getters';
3
3
  import * as StellarActions from './actions';
4
4
  import * as StellarSubmit from './submit';
5
- import { IStellarNetwork, IStellarDepositParams, IStellarRedeemParams, IStellarUserPosition } from './types';
5
+ import type { IStellarNetwork, IStellarDepositParams, IStellarRedeemParams, IStellarUserPosition } from './types';
6
6
  export declare const Stellar: {
7
7
  utils: {
8
8
  isStellarAddress: typeof import("./utils").isStellarAddress;
@@ -76,8 +76,25 @@ async function queryContract(config, contractId, method, args = []) {
76
76
  return null;
77
77
  }
78
78
  }
79
+ async function getNetworkCloseTime(server) {
80
+ try {
81
+ const { sequence } = await server.getLatestLedger();
82
+ const page = await server.getLedgers({
83
+ startLedger: sequence,
84
+ pagination: { limit: 1 },
85
+ });
86
+ return typeof page.latestLedgerCloseTime === 'number'
87
+ ? page.latestLedgerCloseTime
88
+ : null;
89
+ }
90
+ catch (err) {
91
+ core_1.Logger.log.warn('getNetworkCloseTime', `Network clock unavailable; falling back to local clock for tx timebounds: ${String(err)}`);
92
+ return null;
93
+ }
94
+ }
79
95
  async function buildSorobanTx(config, sourceAddress, contractId, method, args) {
80
96
  const server = createServer(config.rpcUrl);
97
+ const networkCloseTimePromise = getNetworkCloseTime(server);
81
98
  let account;
82
99
  try {
83
100
  account = await server.getAccount(sourceAddress);
@@ -91,13 +108,18 @@ async function buildSorobanTx(config, sourceAddress, contractId, method, args) {
91
108
  throw err;
92
109
  }
93
110
  const contract = new stellar_sdk_1.Contract(contractId);
94
- const tx = new stellar_sdk_1.TransactionBuilder(account, {
111
+ const builder = new stellar_sdk_1.TransactionBuilder(account, {
95
112
  fee: constants_1.MAX_FEE_STROOPS,
96
113
  networkPassphrase: config.passphrase,
97
- })
98
- .addOperation(contract.call(method, ...args))
99
- .setTimeout(constants_1.TX_TIMEOUT_SECONDS)
100
- .build();
114
+ }).addOperation(contract.call(method, ...args));
115
+ const networkCloseTime = await networkCloseTimePromise;
116
+ if (networkCloseTime !== null) {
117
+ builder.setTimebounds(0, networkCloseTime + constants_1.TX_TIMEOUT_SECONDS);
118
+ }
119
+ else {
120
+ builder.setTimeout(constants_1.TX_TIMEOUT_SECONDS);
121
+ }
122
+ const tx = builder.build();
101
123
  const simulated = await server.simulateTransaction(tx);
102
124
  if (stellar_sdk_1.rpc.Api.isSimulationError(simulated)) {
103
125
  throw new core_1.AugustSDKError('UNKNOWN', `Soroban simulation failed: ${extractSimulationError(simulated)}`, { context: { method, contractId } });
@@ -15,4 +15,5 @@ export interface IStellarRedeemParams {
15
15
  export interface IStellarUserPosition {
16
16
  shares: string;
17
17
  decimals: number;
18
+ decimalsFromFallback?: boolean;
18
19
  }
@@ -4,6 +4,7 @@ exports.getEmberVaults = getEmberVaults;
4
4
  exports.getEmberTVL = getEmberTVL;
5
5
  const constants_1 = require("./constants");
6
6
  const core_1 = require("../../core");
7
+ const logger_1 = require("../../core/logger");
7
8
  async function getEmberVaults(options) {
8
9
  try {
9
10
  const params = new URLSearchParams();
@@ -23,7 +24,7 @@ async function getEmberVaults(options) {
23
24
  return Array.isArray(data) ? data : [];
24
25
  }
25
26
  catch (error) {
26
- console.error('Error fetching Ember vaults:', error);
27
+ logger_1.Logger.log.error('getEmberVaults', error);
27
28
  return [];
28
29
  }
29
30
  }
@@ -46,7 +47,7 @@ async function getEmberTVL(limit = 1) {
46
47
  return 0;
47
48
  }
48
49
  catch (error) {
49
- console.error('Error fetching Ember TVL:', error);
50
+ logger_1.Logger.log.error('getEmberTVL', error);
50
51
  return 0;
51
52
  }
52
53
  }
@@ -56,6 +56,41 @@ function safeSetUser(user) {
56
56
  catch {
57
57
  }
58
58
  }
59
+ function createSentrySink() {
60
+ return {
61
+ captureException(error, context) {
62
+ try {
63
+ const sdk = (0, sentry_runtime_1.getSentrySDK)();
64
+ if (!sdk)
65
+ return;
66
+ sdk.withScope((scope) => {
67
+ scope.setTag('sdk', 'august-digital');
68
+ if (context) {
69
+ for (const [key, value] of Object.entries(context)) {
70
+ if (key === 'tag' && typeof value === 'string') {
71
+ scope.setTag('sdk.origin', value);
72
+ }
73
+ else {
74
+ scope.setExtra(key, value);
75
+ }
76
+ }
77
+ }
78
+ const normalized = error instanceof Error ? error : new Error(String(error));
79
+ sdk.captureException(normalized);
80
+ });
81
+ }
82
+ catch {
83
+ }
84
+ },
85
+ addBreadcrumb(breadcrumb) {
86
+ try {
87
+ (0, sentry_runtime_1.getSentrySDK)()?.addBreadcrumb(breadcrumb);
88
+ }
89
+ catch {
90
+ }
91
+ },
92
+ };
93
+ }
59
94
  function initializeSentry(config, environment, walletAddress, apiKey, appName) {
60
95
  if (isInitialized) {
61
96
  if (isEnabled) {
@@ -144,6 +179,7 @@ function initializeSentry(config, environment, walletAddress, apiKey, appName) {
144
179
  }
145
180
  safeSetTag('partner.id', appName ? `unverified:${appName}` : 'unverified:anonymous');
146
181
  safeSetTag('partner.tier', 'unverified');
182
+ logger_1.Logger.setSentrySink(createSentrySink());
147
183
  isInitialized = true;
148
184
  logger_1.Logger.log.info('analytics.initialized', {
149
185
  runtime: (0, sentry_runtime_1.getSentryRuntime)(),
@@ -219,6 +255,7 @@ function resetAnalytics() {
219
255
  isEnabled = true;
220
256
  currentIdentity = null;
221
257
  cachedApiKey = undefined;
258
+ logger_1.Logger.setSentrySink(null);
222
259
  (0, sentry_runtime_1.resetSentryRuntime)();
223
260
  }
224
261
  async function captureSdkException(error, options) {
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "8.2.0";
1
+ export declare const SDK_VERSION = "8.3.1";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '8.2.0';
4
+ exports.SDK_VERSION = '8.3.1';
5
5
  //# sourceMappingURL=version.js.map
@@ -55,7 +55,7 @@ class AugustBase {
55
55
  if (!augustCheck)
56
56
  throw new Error('August Digital API key is invalid.');
57
57
  this.authorized = true;
58
- console.log('August Digital SDK successfully initialized');
58
+ logger_1.Logger.log.info('init', 'August Digital SDK successfully initialized');
59
59
  return;
60
60
  }
61
61
  requireActiveNetwork() {
@@ -1,4 +1,4 @@
1
- import { IAddress, IContractRunner, IHistoricalTimeseriesResponse, ITokenizedVault, IWSMonitorHeaders, IWSVaultLoan, VaultAddress } from '../types';
1
+ import type { IAddress, IContractRunner, IHistoricalTimeseriesResponse, ITokenizedVault, IWSMonitorHeaders, IWSVaultLoan, VaultAddress } from '../types';
2
2
  import { WEBSERVER_URL } from './constants/core';
3
3
  export type IFetchAugustMethods = 'get' | 'post' | 'put';
4
4
  export type IFetchAugustOptions = {
@@ -320,7 +320,7 @@ async function withRetry(fn, maxRetries = 3, baseDelay = 1000, shouldRetry = isR
320
320
  catch (error) {
321
321
  lastError = error;
322
322
  if (attempt < maxRetries && shouldRetry(error)) {
323
- const delay = baseDelay * Math.pow(2, attempt);
323
+ const delay = baseDelay * 2 ** attempt;
324
324
  logger_1.Logger.log.warn('withRetry', `Attempt ${attempt + 1} failed, retrying in ${delay}ms: ${error.message}`);
325
325
  await new Promise((resolve) => setTimeout(resolve, delay));
326
326
  continue;
@@ -414,7 +414,7 @@ async function fetchTokenizedVaults(pool, headers, loadSubaccounts, loadSnapshot
414
414
  }
415
415
  async function fetchTokenPrice(symbol, provider, coinGeckoKey, headers) {
416
416
  if (!symbol) {
417
- console.error('#fetchTokenPrice: symbol parameter is undefined');
417
+ logger_1.Logger.log.error('fetchTokenPrice', 'symbol parameter is undefined');
418
418
  return 0;
419
419
  }
420
420
  let normalizedSymbol = symbol.toLowerCase();
@@ -593,7 +593,7 @@ async function promiseSettle(promises, maxRetries = 3, baseDelay = 1000) {
593
593
  return await promise;
594
594
  }
595
595
  catch (error) {
596
- console.warn(`Promise at index ${index} failed:`, error);
596
+ logger_1.Logger.log.warn('promiseSettle', `Promise at index ${index} failed`, error);
597
597
  throw error;
598
598
  }
599
599
  }, maxRetries, baseDelay));
@@ -603,7 +603,7 @@ async function promiseSettle(promises, maxRetries = 3, baseDelay = 1000) {
603
603
  return result.value;
604
604
  }
605
605
  else {
606
- console.warn(`Promise at index ${index} failed after retries:`, result.reason);
606
+ logger_1.Logger.log.warn('promiseSettle', `Promise at index ${index} failed after retries`, result.reason);
607
607
  return null;
608
608
  }
609
609
  });
@@ -1,4 +1,4 @@
1
- import { INormalizedNumber } from '../../types';
1
+ import type { INormalizedNumber } from '../../types';
2
2
  export declare function toNormalizedBn(value: string | bigint | number, decimals?: number | bigint): INormalizedNumber;
3
3
  export declare function getFallbackRpcUrls(chainId: number): string[];
4
4
  export declare const filterOutBySize: (usdAmount: number) => boolean;
@@ -184,7 +184,7 @@ function prepareDateForDb(date) {
184
184
  function orderObjArrByDate(objectArray, options) {
185
185
  const selectedOrder = options?.order ?? 'desc';
186
186
  const selectedKey = options?.key ?? 'date';
187
- return objectArray.sort(function (a, b) {
187
+ return objectArray.sort((a, b) => {
188
188
  if (selectedOrder === 'asc')
189
189
  return (new Date(a[selectedKey]).valueOf() - new Date(b[selectedKey]).valueOf());
190
190
  return (new Date(b[selectedKey]).valueOf() - new Date(a[selectedKey]).valueOf());
@@ -80,7 +80,7 @@ function createContract({ provider, address, abi, }) {
80
80
  return;
81
81
  const contract = new ethers_1.Contract(address, abi, provider);
82
82
  if (!contract) {
83
- console.error('#createContract', 'contract does not exist on connected chain');
83
+ logger_1.Logger.log.error('createContract', 'contract does not exist on connected chain');
84
84
  return;
85
85
  }
86
86
  return contract;
@@ -336,7 +336,7 @@ async function getTokenMetadata(provider, asset, meta) {
336
336
  return await Promise.all(getterArr);
337
337
  }
338
338
  catch (e) {
339
- console.error('#getTokenMetadata:', e);
339
+ logger_1.Logger.log.error('getTokenMetadata', e);
340
340
  return [];
341
341
  }
342
342
  }
@@ -348,7 +348,7 @@ const getManagementFeePercent = async (provider, address) => {
348
348
  await contract.managementFeePercent.staticCall();
349
349
  }
350
350
  catch (e) {
351
- console.error('#getManagementFeePercent::simulate:', e);
351
+ logger_1.Logger.log.error('getManagementFeePercent:simulate', e);
352
352
  return undefined;
353
353
  }
354
354
  try {
@@ -357,7 +357,7 @@ const getManagementFeePercent = async (provider, address) => {
357
357
  return Number(fee) / 100;
358
358
  }
359
359
  catch (e) {
360
- console.error('#getManagementFeePercent:', e);
360
+ logger_1.Logger.log.error('getManagementFeePercent', e);
361
361
  return undefined;
362
362
  }
363
363
  };
@@ -376,7 +376,7 @@ async function simulateTransaction(provider, abi, functionName, options) {
376
376
  return customInterface.decodeFunctionResult(functionName, response);
377
377
  }
378
378
  catch (e) {
379
- console.error('#simulateTransaction:', e);
379
+ logger_1.Logger.log.error('simulateTransaction', e);
380
380
  if (String(e).includes('reverted with reason string "denied"'))
381
381
  return true;
382
382
  return false;
@@ -400,7 +400,7 @@ function checkAddress(address, logger, type = 'contract') {
400
400
  }
401
401
  async function getLoanOracleFeeRate(provider, category_id, address, chainId) {
402
402
  if (!(0, ethers_1.isAddress)(address)) {
403
- console.error('#getLoanOracleFee:', 'address is undefined or not a valid address');
403
+ logger_1.Logger.log.error('getLoanOracleFee', 'address is undefined or not a valid address');
404
404
  return;
405
405
  }
406
406
  let _chainId = chainId;
@@ -409,7 +409,7 @@ async function getLoanOracleFeeRate(provider, category_id, address, chainId) {
409
409
  _chainId = Number(chainIdRes);
410
410
  }
411
411
  if (!web3_1.ORACLE_CONTRACTS?.[_chainId]) {
412
- console.warn('#getLoanOracleFeeRate: no oracle address for', _chainId);
412
+ logger_1.Logger.log.warn('getLoanOracleFeeRate', 'no oracle address for', _chainId);
413
413
  return Number(0);
414
414
  }
415
415
  const oracleContract = createContract({
@@ -441,7 +441,7 @@ async function getHistoricalContractData(provider, contractAddress, abi, methodN
441
441
  });
442
442
  }
443
443
  catch (error) {
444
- console.error(`Error at block ${blockNumber}:`, error);
444
+ logger_1.Logger.log.error('getHistoricalContractData', `Error at block ${blockNumber}`, error);
445
445
  }
446
446
  }
447
447
  return results;
@@ -484,7 +484,7 @@ async function getHistoricalContractDataByDate(provider, contractAddress, abi, m
484
484
  for (let timestamp = startTimestamp; timestamp <= endTimestamp; timestamp += intervalSeconds) {
485
485
  const block = await findBlockByTimestamp(timestamp);
486
486
  if (!block) {
487
- console.warn(`No block found for timestamp ${timestamp}`);
487
+ logger_1.Logger.log.warn('getHistoricalContractDataByDate', `No block found for timestamp ${timestamp}`);
488
488
  continue;
489
489
  }
490
490
  const result = await contract[methodName](...args, {
@@ -500,7 +500,7 @@ async function getHistoricalContractDataByDate(provider, contractAddress, abi, m
500
500
  return results;
501
501
  }
502
502
  catch (error) {
503
- console.error('Error fetching historical data:', error);
503
+ logger_1.Logger.log.error('getHistoricalContractDataByDate', error);
504
504
  throw error;
505
505
  }
506
506
  }
@@ -2,6 +2,16 @@ export type SDKLogger = {
2
2
  setTag: (key: string, value: string) => void;
3
3
  captureException: (err: unknown, context?: Record<string, any>) => void;
4
4
  };
5
+ export interface SDKBreadcrumb {
6
+ category: string;
7
+ message: string;
8
+ level: 'info' | 'warning' | 'error';
9
+ data?: Record<string, unknown>;
10
+ }
11
+ export interface SDKSentrySink {
12
+ captureException: (error: unknown, context?: Record<string, unknown>) => void;
13
+ addBreadcrumb: (breadcrumb: SDKBreadcrumb) => void;
14
+ }
5
15
  export interface ILogger {
6
16
  debug?: (tag: string, context?: Record<string, unknown>) => void;
7
17
  info?: (tag: string, context?: Record<string, unknown>) => void;
@@ -12,11 +22,13 @@ declare function setLogger(customLogger: SDKLogger): void;
12
22
  declare function setStructuredLogger(custom: ILogger | null): void;
13
23
  declare function getLogger(): SDKLogger | null;
14
24
  declare function getStructuredLogger(): ILogger | null;
25
+ declare function setSentrySink(sink: SDKSentrySink | null): void;
15
26
  declare function setDevMode(devMode: boolean): void;
16
27
  declare function isDevMode(): boolean;
17
28
  declare const Logger: {
18
29
  setLogger: typeof setLogger;
19
30
  setStructuredLogger: typeof setStructuredLogger;
31
+ setSentrySink: typeof setSentrySink;
20
32
  getLogger: typeof getLogger;
21
33
  getStructuredLogger: typeof getStructuredLogger;
22
34
  setDevMode: typeof setDevMode;
@@ -37,6 +37,7 @@ exports.Logger = exports.Slack = void 0;
37
37
  const sanitize_1 = require("../analytics/sanitize");
38
38
  let logger = null;
39
39
  let structuredLogger = null;
40
+ let sentrySink = null;
40
41
  let isDev = false;
41
42
  function setLogger(customLogger) {
42
43
  logger = customLogger;
@@ -50,6 +51,9 @@ function getLogger() {
50
51
  function getStructuredLogger() {
51
52
  return structuredLogger;
52
53
  }
54
+ function setSentrySink(sink) {
55
+ sentrySink = sink;
56
+ }
53
57
  function setDevMode(devMode) {
54
58
  isDev = devMode;
55
59
  }
@@ -71,6 +75,12 @@ const log = {
71
75
  }
72
76
  logger?.setTag('warning', tag);
73
77
  structuredLogger?.warn?.(tag, structuredContext(safeArgs));
78
+ sentrySink?.addBreadcrumb({
79
+ category: 'sdk.logger',
80
+ level: 'warning',
81
+ message: tag,
82
+ data: structuredContext(safeArgs),
83
+ });
74
84
  },
75
85
  error: (tag, error, context) => {
76
86
  const safeError = (0, sanitize_1.sanitizeError)(error);
@@ -80,8 +90,9 @@ const log = {
80
90
  if (isDev) {
81
91
  console.error(`[${tag}]`, safeError);
82
92
  }
83
- logger?.captureException(safeError, { tag, ...(safeContext ?? {}) });
93
+ logger?.captureException(safeError, { tag, ...safeContext });
84
94
  structuredLogger?.error(tag, safeError, safeContext);
95
+ sentrySink?.captureException(safeError, { tag, ...safeContext });
85
96
  },
86
97
  };
87
98
  function structuredContext(args) {
@@ -101,6 +112,7 @@ function structuredContext(args) {
101
112
  const Logger = {
102
113
  setLogger,
103
114
  setStructuredLogger,
115
+ setSentrySink,
104
116
  getLogger,
105
117
  getStructuredLogger,
106
118
  setDevMode,
@@ -31,7 +31,10 @@ async function fetchVaultWithFallback(vaultAddress, fetchFn, options = {}) {
31
31
  return { success: true, data, strategy: 'extended-retry' };
32
32
  }
33
33
  catch (error) {
34
- console.warn(`Vault ${vaultAddress} failed with extended retry strategy:`, error);
34
+ core_1.Logger.log.warn('fetchVaultWithFallback:extended_retry_failed', {
35
+ vault: vaultAddress,
36
+ error,
37
+ });
35
38
  }
36
39
  return {
37
40
  success: false,
@@ -1,5 +1,5 @@
1
- import { IAddress, IHistoricalTimeseriesResponse, INormalizedNumber, ISubgraphWithdrawProccessed, IVault, IVaultAllocations, IVaultAnnualizedApy, IVaultAvailableRedemption, IVaultLoan, IVaultPosition, IVaultRedemptionHistoryItem, IVaultSummary, IVaultWithdrawals, IVaultPendingRedemptions, IActiveStakingPosition, IVaultHistoricalParams, IVaultUserLifetimePnl, IVaultBorrowerHealthFactor, IVaultPnl, VaultAddress } from '../../types';
2
- import { IVaultBaseOptions } from './types';
1
+ import { type IAddress, type IHistoricalTimeseriesResponse, type INormalizedNumber, type ISubgraphWithdrawProccessed, type IVault, type IVaultAllocations, type IVaultAnnualizedApy, type IVaultAvailableRedemption, type IVaultLoan, type IVaultPosition, type IVaultRedemptionHistoryItem, type IVaultSummary, type IVaultWithdrawals, type IVaultPendingRedemptions, type IActiveStakingPosition, type IVaultHistoricalParams, type IVaultUserLifetimePnl, type IVaultBorrowerHealthFactor, type IVaultPnl, type VaultAddress } from '../../types';
2
+ import type { IVaultBaseOptions } from './types';
3
3
  export declare function getVault({ vault, loans, allocations, options, loadSubaccounts, loadSnapshots, }: {
4
4
  vault: IAddress;
5
5
  loans?: boolean;
@@ -909,9 +909,12 @@ async function getVaultPositions({ vault, wallet, solanaWallet, stellarWallet, o
909
909
  if (stellarWallet && (0, utils_3.isStellarAddress)(stellarWallet)) {
910
910
  const stellarNetwork = v.stellar_vault_metadata?.network_name ?? 'mainnet';
911
911
  const position = await StellarGetters.getStellarUserPosition(v.address, stellarWallet, stellarNetwork);
912
- if (position) {
912
+ if (position && !position.decimalsFromFallback) {
913
913
  balance = (0, core_1.toNormalizedBn)(BigInt(position.shares), position.decimals);
914
914
  }
915
+ else if (position) {
916
+ core_1.Logger.log.warn('getVaultPositions', 'Stellar decimals() unresolved — refusing to scale balance with fallback decimals (showing zero)', { vault: v.address, wallet: stellarWallet });
917
+ }
915
918
  else {
916
919
  core_1.Logger.log.warn('getVaultPositions', 'Stellar position query failed — showing zero balance', { vault: v.address, wallet: stellarWallet });
917
920
  }
@@ -1,4 +1,4 @@
1
- import { IAddress, IContractRunner, INormalizedNumber, IPoolFunctions, ITokenizedVault, IVault } from '../../types';
1
+ import type { IAddress, IContractRunner, INormalizedNumber, IPoolFunctions, ITokenizedVault, IVault } from '../../types';
2
2
  import { ethers } from 'ethers';
3
3
  import type { WalletClient } from 'viem';
4
4
  export declare function walletClientToSigner(walletClient: WalletClient): Promise<ethers.JsonRpcSigner>;
@@ -427,12 +427,13 @@ async function buildFormattedVault(provider, tokenizedVault, contractCalls) {
427
427
  }
428
428
  depositAssets = [...depositAssets, ...extraAssets];
429
429
  totalSupply = contractCalls.totalSupply;
430
- ((maxSupply = (0, core_1.toNormalizedBn)(1000000000000)),
430
+ (maxSupply =
431
+ (0, core_1.toNormalizedBn)(1000000000000)),
431
432
  (receipt = {
432
433
  symbol: tokenizedVault.receipt_token_symbol,
433
434
  address: contractCalls.lpTokenAddress,
434
435
  decimals: contractCalls.decimals,
435
- }));
436
+ });
436
437
  break;
437
438
  }
438
439
  default: {
@@ -1,5 +1,5 @@
1
- import { Signer, Wallet, TransactionResponse } from 'ethers';
2
- import { IAddress } from '../../types';
1
+ import { type Signer, type Wallet, type TransactionResponse } from 'ethers';
2
+ import type { IAddress } from '../../types';
3
3
  import type { ISwapAndDepositOptions, ISwapRouterDirectDepositOptions, ISwapRouterNativeDepositOptions } from '../../types';
4
4
  export type IContractWriteOptions = {
5
5
  target: IAddress;
@@ -452,7 +452,9 @@ async function vaultDeposit(signer, options) {
452
452
  userAddress: wallet,
453
453
  });
454
454
  depositTx = await nativeDepositConfig.contract
455
- .connect(signer)[nativeDepositConfig.functionName](...nativeDepositConfig.args, nativeDepositConfig.value ? { value: nativeDepositConfig.value } : {});
455
+ .connect(signer)[nativeDepositConfig.functionName](...nativeDepositConfig.args, nativeDepositConfig.value
456
+ ? { value: nativeDepositConfig.value }
457
+ : {});
456
458
  }
457
459
  }
458
460
  else {
@@ -392,9 +392,15 @@ export interface ITokenizedVaultEoaOperator {
392
392
  id: string;
393
393
  name: string;
394
394
  }
395
+ export interface IApyOverride {
396
+ is_show_target_apy: boolean;
397
+ is_show_hardcoded_apy: boolean;
398
+ hardcoded_apy: number | null;
399
+ }
395
400
  export interface ITokenizedVaultStrategist {
396
401
  strategist_name: string;
397
402
  strategist_logo: string;
403
+ website_url: string | null;
398
404
  id: string;
399
405
  }
400
406
  export interface IOTCTrade {
@@ -546,6 +552,7 @@ export interface ITokenizedVault {
546
552
  }>;
547
553
  };
548
554
  show_cap_filled: boolean | null;
555
+ apy_override: IApyOverride | null;
549
556
  }
550
557
  export interface IWSVaultHistoricalApy {
551
558
  data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augustdigital/sdk",
3
- "version": "8.2.0",
3
+ "version": "8.3.1",
4
4
  "main": "lib/index.js",
5
5
  "keywords": [
6
6
  "augustdigital",
@@ -13,15 +13,8 @@
13
13
  "license": "MIT",
14
14
  "description": "JS SDK powering the August Digital ecosystem.",
15
15
  "lint-staged": {
16
- "*.{ts,tsx,js,jsx,mjs,cjs}": [
17
- "oxlint",
18
- "eslint --cache --fix"
19
- ],
20
- "*.json": [
21
- "eslint --cache --fix"
22
- ],
23
- "*.{md,html,yaml,yml}": [
24
- "prettier --write"
16
+ "*": [
17
+ "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
25
18
  ]
26
19
  },
27
20
  "files": [
@@ -73,7 +66,7 @@
73
66
  "test:jest:coverage": "jest --coverage",
74
67
  "test:forknet": "node tests/forknet/run.mjs",
75
68
  "clean": "rm -rf ./lib",
76
- "format": "eslint . --fix",
69
+ "format": "biome check --write .",
77
70
  "lint-sdk": "lint-staged",
78
71
  "benchmark": "node benchmarks/run.js",
79
72
  "benchmark:ci": "node benchmarks/run.js --json benchmarks/results.json --md benchmarks/summary.md",