@hsuite/smart-engines-sdk 3.0.2 → 3.1.0

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.
@@ -683,6 +683,19 @@ export interface ValidatorInfo {
683
683
  registeredAt: string;
684
684
  messageType?: "validator.join" | "validator.leave" | "validator.update";
685
685
  }
686
+ export interface ClusterEndpointsView {
687
+ clusterId: string;
688
+ gatewayUrl: string;
689
+ harborUrl?: string;
690
+ natsUrl?: string;
691
+ publicIp?: string;
692
+ region?: string;
693
+ }
694
+ export interface ClusterInfo {
695
+ clusterId: string;
696
+ endpoints: ClusterEndpointsView;
697
+ nodeIds: string[];
698
+ }
686
699
  export type AuthChain = "hedera" | "xrpl" | "polkadot" | "stellar" | "solana";
687
700
  export interface AuthenticateResponse {
688
701
  token: string;
@@ -710,7 +723,7 @@ export type HttpClient = {
710
723
  get<T = any>(path: string): Promise<T>;
711
724
  put<T = any>(path: string, body: unknown): Promise<T>;
712
725
  delete<T = any>(path: string): Promise<T>;
713
- upload<T = any>(path: string, file: Blob | Buffer, filename: string, metadata?: Record<string, string>): Promise<T>;
726
+ upload<T = any>(path: string, file: Blob | Buffer, filename: string, metadata?: Record<string, string>, fieldName?: string): Promise<T>;
714
727
  };
715
728
  export type SubscriptionTierName = "free_testnet" | "starter" | "professional" | "enterprise";
716
729
  export type SubscriptionStatus = "pending_deposit" | "deposit_confirmed" | "active" | "expired" | "cancelled";
@@ -839,7 +852,6 @@ export type EntityCreationResponse = {
839
852
  success: boolean;
840
853
  entityId: string;
841
854
  publicKeys: string[];
842
- signerIndices: number[];
843
855
  threshold: number;
844
856
  ceremonyIds: string[];
845
857
  };
@@ -859,7 +871,6 @@ export type ReshareResponse = {
859
871
  export type EntityDetails = {
860
872
  success: boolean;
861
873
  payload?: unknown;
862
- signerIndices?: number[];
863
874
  validators?: string[];
864
875
  publicKeys?: string[];
865
876
  error?: string;
@@ -1213,6 +1224,43 @@ declare class SnapshotsClient {
1213
1224
  listByToken(tokenId: string, pagination?: PaginationOptions): Promise<SnapshotListResponse>;
1214
1225
  download(snapshotId: string, format?: SnapshotFormat): Promise<any>;
1215
1226
  }
1227
+ export type HistoricalBalanceChain = "hedera" | "xrpl" | "polkadot";
1228
+ export type HistoricalBalanceQueryParams = {
1229
+ chain: HistoricalBalanceChain;
1230
+ entityId: string;
1231
+ account: string;
1232
+ atTimestamp: number;
1233
+ };
1234
+ export type HistoricalBalanceResult = {
1235
+ chain: HistoricalBalanceChain;
1236
+ entityId: string;
1237
+ account: string;
1238
+ atTimestamp: number;
1239
+ balance: string;
1240
+ source: "archive";
1241
+ };
1242
+ export type HistoricalBalanceClientConfig = {
1243
+ baseUrl: string;
1244
+ authToken?: string;
1245
+ apiKey?: string;
1246
+ timeoutMs?: number;
1247
+ fetchImpl?: typeof fetch;
1248
+ };
1249
+ declare class HistoricalBalanceClient {
1250
+ private readonly baseUrl?;
1251
+ private readonly authToken?;
1252
+ private readonly apiKey?;
1253
+ private readonly timeoutMs;
1254
+ private readonly fetchImpl?;
1255
+ private readonly http?;
1256
+ constructor(config: HistoricalBalanceClientConfig | {
1257
+ http: HttpClient;
1258
+ });
1259
+ static fromHttp(http: HttpClient): HistoricalBalanceClient;
1260
+ getBalance(params: HistoricalBalanceQueryParams): Promise<HistoricalBalanceResult>;
1261
+ private validateParams;
1262
+ private standaloneFetch;
1263
+ }
1216
1264
  export type SettlementPurpose = "subscription" | "deposit" | "fee";
1217
1265
  export type SettlementAsset = {
1218
1266
  symbol: string;
@@ -1254,6 +1302,115 @@ declare class SettlementClient {
1254
1302
  confirmXrpLanded(settlementId: string): Promise<SettlementStatusResponse>;
1255
1303
  getHistory(entityId: string): Promise<SettlementHistoryEntry[]>;
1256
1304
  }
1305
+ export type GovernanceVotingPowerMethod = "token_balance" | "quadratic" | "one_person_one_vote" | "nft_based" | "time_weighted" | "delegated";
1306
+ export type GovernanceProposalStatus = "pending" | "active" | "passed" | "failed" | "executed" | "cancelled" | "expired" | "vetoed";
1307
+ export type GovernanceVoteType = "for" | "against" | "abstain";
1308
+ export interface GovernanceProposalData {
1309
+ proposalId: string;
1310
+ proposer: string;
1311
+ title: string;
1312
+ description: string;
1313
+ actions: unknown[];
1314
+ status: GovernanceProposalStatus;
1315
+ createdAt: string | Date;
1316
+ votingStartsAt: string | Date;
1317
+ votingEndsAt: string | Date;
1318
+ executionDeadline?: string | Date;
1319
+ votes: {
1320
+ for: string;
1321
+ against: string;
1322
+ abstain: string;
1323
+ totalVotingPower: string;
1324
+ };
1325
+ executionResult?: {
1326
+ success: boolean;
1327
+ transactionId?: string;
1328
+ error?: string;
1329
+ };
1330
+ }
1331
+ export interface GovernanceConfig {
1332
+ governanceTokenId: string;
1333
+ decimals?: number;
1334
+ votingPowerMethod?: GovernanceVotingPowerMethod;
1335
+ quorumPercent?: number;
1336
+ approvalThresholdPercent?: number;
1337
+ proposalThreshold: string;
1338
+ votingPeriodMs: number;
1339
+ timeLockMs?: number;
1340
+ maxExecutionDelayMs?: number;
1341
+ votingEligibility?: Record<string, unknown>;
1342
+ proposalEligibility?: Record<string, unknown>;
1343
+ allowDelegation?: boolean;
1344
+ allowVoteChange?: boolean;
1345
+ vetoCouncil?: string[];
1346
+ maxActiveProposalsPerAccount?: number;
1347
+ proposalCooldownMs?: number;
1348
+ wisdomWeightFn?: {
1349
+ registryKey: string;
1350
+ };
1351
+ delegation?: {
1352
+ maxHops?: number;
1353
+ decayPerHop?: number;
1354
+ concentrationAlert?: number;
1355
+ };
1356
+ description?: string;
1357
+ }
1358
+ export interface GovernanceValidationContext {
1359
+ chain?: string;
1360
+ network?: "mainnet" | "testnet";
1361
+ callerAccountId: string;
1362
+ timestamp?: string | Date;
1363
+ action: "create_proposal" | "cast_vote" | "execute_proposal" | "cancel_proposal" | "veto" | "delegate";
1364
+ proposal?: GovernanceProposalData;
1365
+ voteType?: GovernanceVoteType;
1366
+ tokenBalance?: string;
1367
+ votingPower?: string;
1368
+ lastProposalAt?: string | Date;
1369
+ activeProposalCount?: number;
1370
+ delegation?: {
1371
+ delegateTo?: string;
1372
+ delegatedPower?: string;
1373
+ };
1374
+ daoId?: string;
1375
+ totalDaoVotingPower?: string;
1376
+ }
1377
+ export interface GovernanceValidationResult {
1378
+ isValid: boolean;
1379
+ reason?: string;
1380
+ metadata?: Record<string, unknown>;
1381
+ validatedAt?: string;
1382
+ }
1383
+ export interface GovernanceSimulateRequest {
1384
+ config: GovernanceConfig;
1385
+ context: GovernanceValidationContext;
1386
+ }
1387
+ declare class GovernanceClient {
1388
+ private readonly http;
1389
+ constructor(http: HttpClient);
1390
+ simulate(params: GovernanceSimulateRequest): Promise<GovernanceValidationResult>;
1391
+ }
1392
+ export type PersonhoodAttestationMethod = "web-of-trust" | "biometric" | "pop-protocol";
1393
+ export interface PersonhoodProof {
1394
+ attestationMethod: PersonhoodAttestationMethod;
1395
+ payload: unknown;
1396
+ }
1397
+ export interface PersonhoodCert {
1398
+ address: string;
1399
+ issuerId: string;
1400
+ attestationMethod: PersonhoodAttestationMethod;
1401
+ issuedAt: number;
1402
+ expiresAt: number;
1403
+ signature: string;
1404
+ }
1405
+ export interface PersonhoodVerifyParams {
1406
+ candidate: string;
1407
+ proof: PersonhoodProof;
1408
+ }
1409
+ declare class PersonhoodClient {
1410
+ private readonly http;
1411
+ constructor(http: HttpClient);
1412
+ verify(params: PersonhoodVerifyParams): Promise<PersonhoodCert | null>;
1413
+ }
1257
1414
  export interface SmartEngineClientConfig {
1258
1415
  baseUrl: string;
1259
1416
  apiKey?: string;
@@ -1276,6 +1433,28 @@ export interface NetworkConnectionConfig {
1276
1433
  mirrorNodeUrl?: string;
1277
1434
  allowInsecure?: boolean;
1278
1435
  }
1436
+ export interface ClusterConnectionConfig {
1437
+ bootstrap: string[];
1438
+ chain: AuthChain;
1439
+ address: string;
1440
+ publicKey: string;
1441
+ signFn: (challenge: string) => string | Promise<string>;
1442
+ metadata?: {
1443
+ appId?: string;
1444
+ appName?: string;
1445
+ };
1446
+ trustAnchor?: {
1447
+ network: "mainnet" | "testnet" | "previewnet";
1448
+ registryTopicId: string;
1449
+ mirrorNodeUrl?: string;
1450
+ };
1451
+ allowInsecure?: boolean;
1452
+ }
1453
+ export interface ClusterConnectionResult {
1454
+ client: SmartEngineClient;
1455
+ cluster: ClusterInfo;
1456
+ session: AuthenticateResponse;
1457
+ }
1279
1458
  export interface NetworkConnectionResult {
1280
1459
  client: SmartEngineClient;
1281
1460
  validator: ValidatorInfo;
@@ -1292,9 +1471,13 @@ declare class SmartEngineClient {
1292
1471
  readonly ipfs: IPFSClient;
1293
1472
  readonly transactions: TransactionsClient;
1294
1473
  readonly snapshots: SnapshotsClient;
1474
+ readonly historicalBalance: HistoricalBalanceClient;
1295
1475
  readonly settlement: SettlementClient;
1476
+ readonly governance: GovernanceClient;
1477
+ readonly personhood: PersonhoodClient;
1296
1478
  constructor(config: SmartEngineClientConfig);
1297
1479
  static connectToNetwork(config: NetworkConnectionConfig): Promise<NetworkConnectionResult>;
1480
+ static connectToCluster(config: ClusterConnectionConfig): Promise<ClusterConnectionResult>;
1298
1481
  getBaseUrl(): string;
1299
1482
  isAuthenticated(): boolean;
1300
1483
  getHttpHealth(): {
@@ -1717,7 +1900,6 @@ export type BaasEndpoints = {
1717
1900
  functions: string;
1718
1901
  messaging: string;
1719
1902
  };
1720
- export type DeployedAppStatus = "pending" | "deploying" | "active" | "suspended" | "deleted";
1721
1903
  export type DeployedAppInfo = {
1722
1904
  appId: string;
1723
1905
  name: string;
@@ -1761,24 +1943,6 @@ export type BaasSessionInfo = {
1761
1943
  expiresAt?: number;
1762
1944
  error?: string;
1763
1945
  };
1764
- export type BaasRegisterRequest = {
1765
- name: string;
1766
- services: BaasService[];
1767
- environment?: Record<string, string>;
1768
- limits?: {
1769
- storage?: string;
1770
- functions?: number;
1771
- channels?: number;
1772
- };
1773
- };
1774
- export type BaasRegisterResponse = {
1775
- appId: string;
1776
- name: string;
1777
- status: DeployedAppStatus;
1778
- services: string[];
1779
- endpoints: BaasEndpoints;
1780
- createdAt: string;
1781
- };
1782
1946
  export type BaasDocument = {
1783
1947
  _id: string;
1784
1948
  data: Record<string, unknown>;
@@ -1956,18 +2120,56 @@ export type BaasPublishResult = {
1956
2120
  channel: string;
1957
2121
  timestamp: string;
1958
2122
  };
1959
- export type BaasDeployRequest = {
2123
+ export type BaasInitRequest = {
1960
2124
  name: string;
2125
+ port: number;
1961
2126
  services: BaasService[];
1962
- config?: Record<string, unknown>;
2127
+ limits?: {
2128
+ cpu?: string;
2129
+ memory?: string;
2130
+ };
1963
2131
  };
1964
- export type BaasDeployResult = {
2132
+ export type BaasInitResponse = {
1965
2133
  appId: string;
1966
- name: string;
1967
- status: "active" | "deploying" | "error";
1968
- services: string[];
1969
- endpoints: BaasEndpoints;
1970
- createdAt: string;
2134
+ registry: {
2135
+ server: string;
2136
+ username: string;
2137
+ password: string;
2138
+ repository: string;
2139
+ };
2140
+ };
2141
+ export type BaasDeployRequest = {
2142
+ tag: string;
2143
+ replicas?: number;
2144
+ env?: Record<string, string>;
2145
+ resources?: {
2146
+ cpu?: string;
2147
+ memory?: string;
2148
+ };
2149
+ strategy?: "rolling" | "recreate";
2150
+ };
2151
+ export type BaasDeployResponse = {
2152
+ appId: string;
2153
+ status: string;
2154
+ url: string;
2155
+ };
2156
+ export type BaasUploadFrontendResponse = {
2157
+ bundleSha256: string;
2158
+ bundleSizeBytes: number;
2159
+ };
2160
+ export type BaasRollbackRequest = {
2161
+ toTag: string;
2162
+ };
2163
+ export type BaasRuntimeStatus = {
2164
+ appId: string;
2165
+ state: "PENDING_SUBSCRIPTION" | "ACTIVE" | "SUSPENDED" | "RETIRED";
2166
+ runtime?: {
2167
+ image: string;
2168
+ runtimeState: "NOT_DEPLOYED" | "DEPLOYING" | "RUNNING" | "FAILED" | "DEGRADED";
2169
+ replicas: number;
2170
+ lastReconciledAt?: string;
2171
+ lastError?: string;
2172
+ };
1971
2173
  };
1972
2174
  export type BaasAppListResponse = {
1973
2175
  apps: DeployedAppInfo[];
@@ -2100,7 +2302,11 @@ declare class MessagingClient {
2100
2302
  declare class DeploymentClient {
2101
2303
  private readonly http;
2102
2304
  constructor(http: HttpClient);
2103
- create(request: BaasDeployRequest): Promise<BaasDeployResult>;
2305
+ init(request: BaasInitRequest): Promise<BaasInitResponse>;
2306
+ uploadFrontend(appId: string, bundle: Blob | Buffer, filename?: string): Promise<BaasUploadFrontendResponse>;
2307
+ deploy(appId: string, request: BaasDeployRequest): Promise<BaasDeployResponse>;
2308
+ rollback(appId: string, request: BaasRollbackRequest): Promise<BaasDeployResponse>;
2309
+ status(appId: string): Promise<BaasRuntimeStatus>;
2104
2310
  list(): Promise<BaasAppListResponse>;
2105
2311
  get(appId: string): Promise<DeployedAppInfo>;
2106
2312
  update(appId: string, updates: Partial<BaasDeployRequest>): Promise<DeployedAppInfo>;
@@ -2115,7 +2321,11 @@ declare class DeploymentClient {
2115
2321
  success: boolean;
2116
2322
  status: string;
2117
2323
  }>;
2118
- getStats(): Promise<any>;
2324
+ getStats(): Promise<{
2325
+ totalApps: number;
2326
+ activeApps: number;
2327
+ totalOwners: number;
2328
+ }>;
2119
2329
  }
2120
2330
  export type AgentStatus = "active" | "paused" | "revoked" | "pending";
2121
2331
  export type AgentRegisterRequest = {
@@ -2226,6 +2436,55 @@ declare class AgentsClient {
2226
2436
  success: boolean;
2227
2437
  }>;
2228
2438
  }
2439
+ export type CustomerSessionChallenge = {
2440
+ challenge: string;
2441
+ };
2442
+ export type CustomerSessionVerifyRequest = {
2443
+ appId: string;
2444
+ chain: string;
2445
+ address: string;
2446
+ publicKey?: string;
2447
+ signature: string;
2448
+ challenge: string;
2449
+ };
2450
+ export type CustomerSessionToken = {
2451
+ token: string;
2452
+ sessionId: string;
2453
+ validatorId: string;
2454
+ expiresAt: string;
2455
+ sessionSecret: string;
2456
+ };
2457
+ export type CustomerSessionInfo = {
2458
+ sessionId: string;
2459
+ appId: string;
2460
+ customerChain: string;
2461
+ customerAddress: string;
2462
+ subscriptionContext?: {
2463
+ nftSerial: number;
2464
+ tier: "free_testnet" | "starter" | "professional" | "enterprise";
2465
+ expiresAt: string;
2466
+ allowedAutomations?: string[];
2467
+ };
2468
+ createdAt: string;
2469
+ expiresAt: string;
2470
+ lastActivityAt: string;
2471
+ };
2472
+ declare class CustomerSessionClient {
2473
+ private readonly baseUrl;
2474
+ private readonly timeoutMs;
2475
+ constructor(baseUrl: string, timeoutMs?: number);
2476
+ challenge(input: {
2477
+ chain: string;
2478
+ address: string;
2479
+ }): Promise<CustomerSessionChallenge>;
2480
+ verify(req: CustomerSessionVerifyRequest): Promise<CustomerSessionToken>;
2481
+ validate(bearer: string): Promise<CustomerSessionInfo>;
2482
+ end(bearer: string): Promise<{
2483
+ revoked: boolean;
2484
+ sessionId: string;
2485
+ }>;
2486
+ private fetch;
2487
+ }
2229
2488
  export type AuthenticateOptions = {
2230
2489
  chain: BaasSupportedChain;
2231
2490
  walletAddress: string;
@@ -2247,6 +2506,7 @@ declare class BaasClient {
2247
2506
  readonly messaging: MessagingClient;
2248
2507
  readonly deployment: DeploymentClient;
2249
2508
  readonly agents: AgentsClient;
2509
+ readonly customerSession: CustomerSessionClient;
2250
2510
  constructor(config: BaasClientConfig);
2251
2511
  setAppId(appId: string): void;
2252
2512
  isAuthenticated(): boolean;
@@ -2259,7 +2519,6 @@ declare class BaasClient {
2259
2519
  authenticate(options: AuthenticateOptions): Promise<BaasAuthResult>;
2260
2520
  validateSession(): Promise<BaasSessionInfo>;
2261
2521
  logout(): Promise<void>;
2262
- register(request: BaasRegisterRequest): Promise<BaasRegisterResponse>;
2263
2522
  private requireAuth;
2264
2523
  private getHeaders;
2265
2524
  private post;