Types
All TypeScript types exported from @knight-shield/core.
Import
import type {
Network,
NetworkConfig,
TokenBalance,
TokenInfo,
TxResult,
WalletState,
RelaySession,
RelayConfig,
TimingConfig,
FeeNormalizationConfig,
Shard,
ShardConfig,
ShardStorageType,
} from '@knight-shield/core';
Network
type Network = 'preprod' | 'preview' | 'standalone';
NetworkConfig
interface NetworkConfig {
node: string; // Midnight node WebSocket URL
indexer: string; // Indexer GraphQL endpoint
proofServer: string; // ZK proof server URL
faucet?: string; // Faucet URL (preprod/preview only)
}
TokenBalance
interface TokenBalance {
symbol: string;
balance: bigint;
}
TokenInfo
interface TokenInfo {
symbol: string;
contractAddress: string;
rawTokenType?: string;
}
TxResult
interface TxResult {
txHash: string;
blockHeight?: number;
status: 'submitted' | 'confirmed' | 'failed';
}
WalletState
interface WalletState {
address: string;
network: Network;
synced: boolean;
balances: Map<string, bigint>;
}
RelaySession (GhostCloak)
interface RelaySession {
sessionId: string;
startedAt: Date;
isActive: boolean;
relayUrl: string;
}
RelayConfig
interface RelayConfig {
url: string;
timeout?: number;
}
TimingConfig (GhostTracking)
interface TimingConfig {
minDelayMs: number;
maxDelayMs: number;
}
FeeNormalizationConfig (GhostTracking)
interface FeeNormalizationConfig {
flatFee: bigint;
poolContractAddress: string;
}
Shard (GhostShard)
interface Shard {
shardId: string;
shardData: Uint8Array;
storageType: ShardStorageType;
hash: string;
}
ShardConfig
interface ShardConfig {
totalShares: number;
threshold: number;
}
ShardStorageType
type ShardStorageType = 'did' | 'usb' | 'pwd_mgr' | 'email' | 'cloud' | 'device';
SHARD_STORAGE_TYPE_MAP
const SHARD_STORAGE_TYPE_MAP: Record<ShardStorageType, number> = {
did: 1,
usb: 2,
pwd_mgr: 3,
email: 4,
cloud: 5,
device: 6,
};