Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/components/dashboard/AuditLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,5 @@ export default function AuditLog() {
)}
</div>
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion src/lib/sac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
await server.getContractData(
contractId,
StellarSdk.xdr.ScVal.scvLedgerKeyContractInstance(),
StellarSdk.SorobanRpc.Durability.Persistent,
StellarSdk.rpc.Durability.Persistent,
)
return { contractId, deployed: true, metadata }
} catch (error) {
Expand Down Expand Up @@ -84,6 +84,6 @@
.build()
const signedXdr = await sign(transaction.toXDR(), network.toUpperCase())
const signed = StellarSdk.TransactionBuilder.fromXDR(signedXdr, NETWORKS[network].passphrase)
const result = await horizon.submitTransaction(signed as any)

Check failure on line 87 in src/lib/sac.ts

View workflow job for this annotation

GitHub Actions / Lint & Format Check

Direct call to submitTransaction() bypasses the mainnet safety guard. Use useWriteGuard().guard({ onConfirm }) instead, or add this file to the allowlist in eslint-rules/no-direct-submit.mjs
return { hash: result.hash, contractId: getSacContractId(asset, network) }
}
2 changes: 1 addition & 1 deletion src/lib/stellar/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@

export function getServer(network: NetworkName = 'testnet'): StellarSdk.Horizon.Server {
const config = NETWORKS[network];
return new StellarSdk.Horizon.Server(

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 26)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > derives performance and risk metrics from the reconstructed history

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ tests/integration/portfolioAnalytics.test.ts:291:27

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 26)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > reconstructs portfolio history from Horizon effects and values it with current prices

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ tests/integration/portfolioAnalytics.test.ts:268:7

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 26)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > loads account assets, prices them, values them in USD and derives an allocation

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ runAnalyticsPipeline tests/integration/portfolioAnalytics.test.ts:190:25 ❯ tests/integration/portfolioAnalytics.test.ts:216:62

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 24)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > derives performance and risk metrics from the reconstructed history

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ tests/integration/portfolioAnalytics.test.ts:291:27

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 24)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > reconstructs portfolio history from Horizon effects and values it with current prices

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ tests/integration/portfolioAnalytics.test.ts:268:7

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 24)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > loads account assets, prices them, values them in USD and derives an allocation

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ runAnalyticsPipeline tests/integration/portfolioAnalytics.test.ts:190:25 ❯ tests/integration/portfolioAnalytics.test.ts:216:62

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Coverage Gate

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > derives performance and risk metrics from the reconstructed history

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ tests/integration/portfolioAnalytics.test.ts:291:27

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Coverage Gate

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > reconstructs portfolio history from Horizon effects and values it with current prices

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ tests/integration/portfolioAnalytics.test.ts:268:7

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Coverage Gate

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > loads account assets, prices them, values them in USD and derives an allocation

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ runAnalyticsPipeline tests/integration/portfolioAnalytics.test.ts:190:25 ❯ tests/integration/portfolioAnalytics.test.ts:216:62

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 22)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > derives performance and risk metrics from the reconstructed history

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ tests/integration/portfolioAnalytics.test.ts:291:27

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 22)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > reconstructs portfolio history from Horizon effects and values it with current prices

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ tests/integration/portfolioAnalytics.test.ts:268:7

Check failure on line 282 in src/lib/stellar/networks.ts

View workflow job for this annotation

GitHub Actions / Unit & Integration Tests (Node 22)

tests/integration/portfolioAnalytics.test.ts > portfolio analytics: end-to-end pipeline > loads account assets, prices them, values them in USD and derives an allocation

TypeError: URL is not a constructor ❯ new HorizonServer node_modules/.pnpm/@stellar+stellar-sdk@17.1.0/node_modules/@stellar/stellar-sdk/src/horizon/server.ts:109:22 ❯ Module.getServer src/lib/stellar/networks.ts:282:10 ❯ Module.fetchAccount src/lib/stellar/horizon.ts:67:18 ❯ runAnalyticsPipeline tests/integration/portfolioAnalytics.test.ts:190:25 ❯ tests/integration/portfolioAnalytics.test.ts:216:62
config.horizonUrl || NETWORKS.testnet.horizonUrl,
getServerOptions(network)
);
Expand All @@ -288,7 +288,7 @@
/** @deprecated Use getServer directly. */
export const ee = getServer;

export function getSorobanServer(network: NetworkName = 'testnet'): StellarSdk.SorobanRpc.Server {
export function getSorobanServer(network: NetworkName = 'testnet'): StellarSdk.rpc.Server {
const config = NETWORKS[network];
if (network === 'custom' && !config.sorobanUrl) {
throw new Error('Custom Soroban RPC URL not configured');
Expand Down
6 changes: 3 additions & 3 deletions src/lib/stellar/rpcReadSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ export const RPC_RETENTION_LIMIT_LEDGERS = 100_000;
export class RpcReadSource implements StellarReadSource {
private network: NetworkName;
private retentionLimit: number;
private serverGetter?: (_network: NetworkName) => StellarSdk.SorobanRpc.Server;
private serverGetter?: (_network: NetworkName) => StellarSdk.rpc.Server;

constructor(
network: NetworkName = 'testnet',
retentionLimit: number = RPC_RETENTION_LIMIT_LEDGERS,
serverGetter?: (_network: NetworkName) => StellarSdk.SorobanRpc.Server
serverGetter?: (_network: NetworkName) => StellarSdk.rpc.Server
) {
this.network = network;
this.retentionLimit = retentionLimit;
this.serverGetter = serverGetter;
}

private getServer(): StellarSdk.SorobanRpc.Server {
private getServer(): StellarSdk.rpc.Server {
if (this.serverGetter) {
return this.serverGetter(this.network);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stellar/soroban.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function fetchContractData(
contractId: string,
key: StellarSdk.xdr.ScVal | string,
network: NetworkName = 'testnet',
durability: StellarSdk.rpc.Durability = StellarSdk.SorobanRpc.Durability.Persistent
durability: StellarSdk.rpc.Durability = StellarSdk.rpc.Durability.Persistent
): Promise<any> {
const server = getSorobanServer(network);

Expand Down
6 changes: 3 additions & 3 deletions src/lib/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { create } from 'zustand'
import { getStoredValue } from './storage'
import { syncState, onStateChange, resolveStateConflict, loadSyncedState, getTabId } from '../utils/stateSync'
import type { NetworkName, NetworkStats } from './stellar'
import type { Horizon, SorobanRpc } from '@stellar/stellar-sdk'
import type { Horizon, rpc } from '@stellar/stellar-sdk'
import { generateInsights, type AnalyticsSummary } from './analytics'
import { accountRequests } from './requestCancellation'
import { applyCustomThemeToDOM, removeCustomThemeFromDOM, saveThemeVarsToStorage, clearThemeVarsFromStorage, type ThemeDefinition } from '../styles/themeTypes'
Expand Down Expand Up @@ -93,7 +93,7 @@ export interface NetworkSlice {
faucetLoading: boolean
faucetResult: unknown
contractId: string
contractData: SorobanRpc.Api.LedgerEntryResult | null
contractData: rpc.Api.LedgerEntryResult | null
contractLoading: boolean
contractError: string | null
deploymentStatus: Record<string, unknown> | null
Expand Down Expand Up @@ -242,7 +242,7 @@ export interface StoreState extends NetworkSlice, SessionSlice, AccountSlice, Ui
setFaucetResult: (r: unknown) => void

setContractId: (id: string) => void
setContractData: (data: SorobanRpc.Api.LedgerEntryResult) => void
setContractData: (data: rpc.Api.LedgerEntryResult) => void
setContractLoading: (v: boolean) => void
setContractError: (e: string | null) => void

Expand Down
4 changes: 2 additions & 2 deletions src/lib/wallet/smartWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export async function fetchSacBalances(
const simResponse = await server.simulateTransaction(tx)

if (
StellarSdk.SorobanRpc.Api.isSimulationSuccess(simResponse) &&
StellarSdk.rpc.Api.isSimulationSuccess(simResponse) &&
simResponse.result?.retval
) {
const retval = simResponse.result.retval
Expand Down Expand Up @@ -363,7 +363,7 @@ export async function fetchSmartWalletAccount(

const simResp = await server.simulateTransaction(tx)
if (
StellarSdk.SorobanRpc.Api.isSimulationSuccess(simResp) &&
StellarSdk.rpc.Api.isSimulationSuccess(simResp) &&
simResp.result?.retval
) {
const native = StellarSdk.scValToNative(simResp.result.retval)
Expand Down
3 changes: 2 additions & 1 deletion src/ml/isolation_forest.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Simple Isolation Forest implementation (approximate)
const fs = require('fs');

function c(n) {
if (n <= 1) return 0;
Expand Down Expand Up @@ -77,11 +76,13 @@ class IsolationForest {
}

save(path) {
const fs = require('fs');
fs.mkdirSync(require('path').dirname(path), { recursive: true });
fs.writeFileSync(path, JSON.stringify(this.toJSON()));
}

static load(path) {
const fs = require('fs');
const raw = fs.readFileSync(path, 'utf8');
const obj = JSON.parse(raw);
const f = new IsolationForest(obj.nTrees, obj.sampleSize);
Expand Down
7 changes: 4 additions & 3 deletions src/ml/isolation_forest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const { IsolationForest } = require('./isolation_forest.cjs')
import isolationForestModule from './isolation_forest.cjs'

const { IsolationForest } = isolationForestModule

export { IsolationForest }
Loading