@hsuite/smart-engines-sdk 3.2.0 → 3.2.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.
@@ -265,7 +265,6 @@ declare const CreateAccountRequestSchema: z.ZodObject<{
265
265
  validatorTopicId: z.ZodString;
266
266
  immutable: z.ZodDefault<z.ZodBoolean>;
267
267
  securityMode: z.ZodDefault<z.ZodEnum<[
268
- "none",
269
268
  "partial",
270
269
  "full"
271
270
  ]>>;
@@ -273,7 +272,7 @@ declare const CreateAccountRequestSchema: z.ZodObject<{
273
272
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
274
273
  }, "strip", z.ZodTypeAny, {
275
274
  chain: "hedera" | "xrpl" | "polkadot" | "solana" | "stellar" | "ethereum" | "polygon" | "bitcoin" | "cardano";
276
- securityMode: "none" | "partial" | "full";
275
+ securityMode: "partial" | "full";
277
276
  initialBalance: string;
278
277
  validatorTimestamp: string;
279
278
  validatorTopicId: string;
@@ -290,7 +289,7 @@ declare const CreateAccountRequestSchema: z.ZodObject<{
290
289
  validatorTopicId: string;
291
290
  publicKey?: string | undefined;
292
291
  metadata?: Record<string, any> | undefined;
293
- securityMode?: "none" | "partial" | "full" | undefined;
292
+ securityMode?: "partial" | "full" | undefined;
294
293
  appOwnerPublicKey?: string | undefined;
295
294
  memo?: string | undefined;
296
295
  payerAccountId?: string | undefined;
@@ -1015,7 +1014,7 @@ declare class IPFSClient {
1015
1014
  getStatus(): Promise<IpfsStatusResponse>;
1016
1015
  getStorageUsage(): Promise<IpfsStorageUsageResponse>;
1017
1016
  }
1018
- export type SecurityMode = "none" | "partial" | "full";
1017
+ export type SecurityMode = "partial" | "full";
1019
1018
  export type PreparedTransaction = {
1020
1019
  success?: boolean;
1021
1020
  transactionBytes: string;
@@ -1538,773 +1537,914 @@ declare class PersonhoodClient {
1538
1537
  constructor(http: HttpClient);
1539
1538
  verify(params: PersonhoodVerifyParams): Promise<PersonhoodCert | null>;
1540
1539
  }
1541
- export interface SmartEngineClientConfig {
1542
- baseUrl: string;
1543
- apiKey?: string;
1544
- authToken?: string;
1545
- timeout?: number;
1546
- allowInsecure?: boolean;
1547
- http?: ResilientHttpConfig;
1548
- }
1549
- export interface NetworkConnectionConfig {
1550
- network: "mainnet" | "testnet" | "previewnet";
1551
- registryTopicId: string;
1552
- chain: AuthChain;
1553
- address: string;
1554
- publicKey: string;
1555
- signFn: (challenge: string) => string | Promise<string>;
1556
- metadata?: {
1557
- appId?: string;
1558
- appName?: string;
1559
- };
1560
- mirrorNodeUrl?: string;
1561
- allowInsecure?: boolean;
1562
- }
1563
- export interface ClusterConnectionConfig {
1564
- bootstrap: string[];
1565
- chain: AuthChain;
1566
- address: string;
1567
- publicKey: string;
1568
- signFn: (challenge: string) => string | Promise<string>;
1569
- metadata?: {
1570
- appId?: string;
1571
- appName?: string;
1572
- };
1573
- trustAnchor?: {
1574
- network: "mainnet" | "testnet" | "previewnet";
1575
- registryTopicId: string;
1576
- mirrorNodeUrl?: string;
1540
+ export type AgentStatus = "active" | "paused" | "revoked" | "pending";
1541
+ export type AgentRegisterRequest = {
1542
+ name: string;
1543
+ description?: string;
1544
+ capabilities: string[];
1545
+ rules: AgentRules;
1546
+ fundingConfig?: {
1547
+ chain: string;
1548
+ maxAmount: string;
1549
+ autoFund: boolean;
1577
1550
  };
1578
- allowInsecure?: boolean;
1579
- }
1580
- export interface ClusterConnectionResult {
1581
- client: SmartEngineClient;
1582
- cluster: ClusterInfo;
1583
- session: AuthenticateResponse;
1584
- }
1585
- export interface NetworkConnectionResult {
1586
- client: SmartEngineClient;
1587
- validator: ValidatorInfo;
1588
- session: AuthenticateResponse;
1589
- }
1590
- declare class SmartEngineClient {
1591
- private baseUrl;
1592
- private allowInsecure;
1551
+ };
1552
+ export type AgentRules = {
1553
+ maxTradeAmount?: string;
1554
+ allowedPairs?: string[];
1555
+ allowedChains?: string[];
1556
+ dailyLimit?: string;
1557
+ requireApprovalAbove?: string;
1558
+ customRules?: Record<string, unknown>;
1559
+ };
1560
+ export type AgentInfo = {
1561
+ agentId: string;
1562
+ name: string;
1563
+ description?: string;
1564
+ status: AgentStatus;
1565
+ capabilities: string[];
1566
+ rules: AgentRules;
1567
+ owner: string;
1568
+ createdAt: string;
1569
+ lastActiveAt?: string;
1570
+ };
1571
+ export type AgentEvent = {
1572
+ eventId: string;
1573
+ agentId: string;
1574
+ type: string;
1575
+ data: Record<string, unknown>;
1576
+ timestamp: string;
1577
+ };
1578
+ export type AgentBalance = {
1579
+ chain: string;
1580
+ accountId: string;
1581
+ balance: string;
1582
+ symbol: string;
1583
+ };
1584
+ export type AgentFundRequest = {
1585
+ chain: string;
1586
+ amount: string;
1587
+ source?: string;
1588
+ };
1589
+ export type AgentTradeRequest = {
1590
+ chain: string;
1591
+ pair: string;
1592
+ side: "buy" | "sell";
1593
+ amount: string;
1594
+ price?: string;
1595
+ };
1596
+ export type AgentWithdrawRequest = {
1597
+ chain: string;
1598
+ amount: string;
1599
+ destination: string;
1600
+ };
1601
+ declare class AgentsClient {
1593
1602
  private readonly http;
1594
- private readonly txHttp;
1595
- private lastHttpError?;
1596
- readonly subscription: SubscriptionClient;
1597
- readonly tss: TSSClient;
1598
- readonly ipfs: IPFSClient;
1599
- readonly transactions: TransactionsClient;
1600
- readonly hedera: HederaTransactionsClient;
1601
- readonly xrpl: XrplTransactionsClient;
1602
- readonly solana: SolanaTransactionsClient;
1603
- readonly polkadot: PolkadotTransactionsClient;
1604
- readonly snapshots: SnapshotsClient;
1605
- readonly historicalBalance: HistoricalBalanceClient;
1606
- readonly settlement: SettlementClient;
1607
- readonly governance: GovernanceClient;
1608
- readonly personhood: PersonhoodClient;
1609
- constructor(config: SmartEngineClientConfig);
1610
- static connectToNetwork(config: NetworkConnectionConfig): Promise<NetworkConnectionResult>;
1611
- static connectToCluster(config: ClusterConnectionConfig): Promise<ClusterConnectionResult>;
1612
- getBaseUrl(): string;
1613
- isAuthenticated(): boolean;
1614
- getHttpHealth(): {
1615
- breaker: CircuitBreakerSnapshot | null;
1616
- lastError?: Error;
1617
- };
1618
- getHealth(): Promise<{
1619
- status: string;
1620
- timestamp: string;
1621
- chains: any[];
1603
+ constructor(http: HttpClient);
1604
+ register(request: AgentRegisterRequest): Promise<AgentInfo>;
1605
+ get(agentId: string): Promise<AgentInfo>;
1606
+ list(): Promise<{
1607
+ agents: AgentInfo[];
1608
+ total: number;
1622
1609
  }>;
1623
- getSupportedChains(): Promise<{
1624
- chains: string[];
1610
+ fund(agentId: string, request: AgentFundRequest): Promise<{
1611
+ success: boolean;
1612
+ txId?: string;
1625
1613
  }>;
1626
- createAccount(request: CreateAccountRequest): Promise<CreateAccountResponse>;
1627
- getAccountInfo(chain: string, accountId: string): Promise<AccountInfo>;
1628
- getBalance(chain: string, accountId: string): Promise<AccountBalance>;
1629
- transfer(request: TransferRequest): Promise<TransferResponse>;
1630
- getTransaction(chain: string, txId: string): Promise<Transaction>;
1631
- getTransactionReceipt(chain: string, txId: string): Promise<any>;
1632
- createToken(request: CreateTokenRequest): Promise<CreateTokenResponse>;
1633
- mintToken(request: MintTokenRequest): Promise<any>;
1634
- getTokenInfo(chain: string, tokenId: string): Promise<TokenInfo>;
1635
- burnToken(request: BurnTokenRequest): Promise<ActionResult>;
1636
- pauseToken(request: TokenActionRequest): Promise<ActionResult>;
1637
- unpauseToken(request: TokenActionRequest): Promise<ActionResult>;
1638
- restrictAccount(request: TokenActionRequest): Promise<ActionResult>;
1639
- unrestrictAccount(request: TokenActionRequest): Promise<ActionResult>;
1640
- enableCompliance(request: TokenActionRequest): Promise<ActionResult>;
1641
- disableCompliance(request: TokenActionRequest): Promise<ActionResult>;
1642
- wipeFromAccount(request: TokenActionRequest): Promise<ActionResult>;
1643
- getAllCapabilities(): Promise<any>;
1644
- getChainCapabilities(chain: ChainType): Promise<any>;
1645
- getSystemStatus(): Promise<any>;
1646
- submitMessage(chain: string, topicId: string, message: string): Promise<any>;
1647
- getClusterHealth(): Promise<{
1614
+ trade(agentId: string, request: AgentTradeRequest): Promise<{
1615
+ success: boolean;
1616
+ txId?: string;
1617
+ }>;
1618
+ withdraw(agentId: string, request: AgentWithdrawRequest): Promise<{
1619
+ success: boolean;
1620
+ txId?: string;
1621
+ }>;
1622
+ pause(agentId: string): Promise<{
1623
+ success: boolean;
1648
1624
  status: string;
1649
- nodes: number;
1650
- healthy: number;
1651
- unhealthy: number;
1652
1625
  }>;
1653
- getClusterStatus(): Promise<{
1626
+ resume(agentId: string): Promise<{
1627
+ success: boolean;
1654
1628
  status: string;
1655
- nodeId: string;
1656
- nodes: Array<{
1657
- nodeId: string;
1658
- endpoint: string;
1659
- status: string;
1660
- lastSeen?: string;
1661
- }>;
1662
- quorum: {
1663
- required: number;
1664
- current: number;
1665
- reached: boolean;
1666
- };
1667
1629
  }>;
1668
- getMetrics(): Promise<string>;
1669
- getQueueStats(): Promise<{
1670
- queues: Record<string, {
1671
- pending: number;
1672
- processing: number;
1673
- completed: number;
1674
- failed: number;
1675
- }>;
1676
- timestamp: string;
1630
+ revoke(agentId: string): Promise<{
1631
+ success: boolean;
1632
+ status: string;
1677
1633
  }>;
1678
- getCircuitBreakerStatus(): Promise<{
1679
- breakers: Record<string, {
1680
- state: "closed" | "open" | "half-open";
1681
- failures: number;
1682
- successes: number;
1683
- lastFailure?: string;
1684
- nextRetry?: string;
1685
- }>;
1686
- timestamp: string;
1634
+ updateRules(agentId: string, rules: Partial<AgentRules>): Promise<AgentInfo>;
1635
+ getEvents(agentId: string): Promise<{
1636
+ events: AgentEvent[];
1637
+ total: number;
1687
1638
  }>;
1688
- verifySignature(request: {
1689
- chain: ChainType;
1690
- message: string;
1691
- signature: string;
1692
- publicKey: string;
1693
- }): Promise<{
1694
- valid: boolean;
1695
- chain: ChainType;
1639
+ getBalances(agentId: string): Promise<{
1640
+ balances: AgentBalance[];
1641
+ }>;
1642
+ approve(agentId: string, operationId: string): Promise<{
1643
+ success: boolean;
1644
+ }>;
1645
+ reject(agentId: string, operationId: string): Promise<{
1646
+ success: boolean;
1696
1647
  }>;
1697
1648
  }
1698
- export type GatewayHealthResponse = {
1699
- status: "healthy" | "degraded" | "unhealthy";
1700
- timestamp: string;
1701
- uptime: number;
1702
- version: string;
1649
+ export type BaasService = "auth" | "database" | "storage" | "functions" | "messaging";
1650
+ export type BaasSupportedChain = "hedera" | "xrpl" | "polkadot" | "solana";
1651
+ export type BaasEndpoints = {
1652
+ auth: string;
1653
+ database: string;
1654
+ storage: string;
1655
+ functions: string;
1656
+ messaging: string;
1703
1657
  };
1704
- export type GatewayStatusResponse = {
1705
- status: string;
1706
- hosts: {
1707
- total: number;
1708
- verified: number;
1709
- active: number;
1710
- };
1711
- domains: {
1712
- total: number;
1713
- verified: number;
1714
- };
1715
- uptime: number;
1658
+ export type DeployedAppInfo = {
1659
+ appId: string;
1660
+ name: string;
1661
+ status: "active" | "inactive" | "deploying" | "error";
1662
+ services: string[];
1663
+ endpoints: BaasEndpoints;
1664
+ createdAt: string;
1716
1665
  };
1717
- export type GatewayReadinessResponse = {
1718
- ready: boolean;
1719
- checks: Record<string, boolean>;
1666
+ export type BaasAuthConfig = {
1667
+ chain: BaasSupportedChain;
1668
+ walletAddress: string;
1669
+ publicKey: string;
1670
+ signFn: (message: string) => string | Promise<string>;
1671
+ };
1672
+ export type BaasClientConfig = {
1673
+ hostUrl: string;
1674
+ appId?: string;
1675
+ appName?: string;
1676
+ auth?: BaasAuthConfig;
1677
+ services?: BaasService[];
1678
+ timeout?: number;
1679
+ allowInsecure?: boolean;
1680
+ http?: ResilientHttpConfig;
1681
+ pathPrefix?: string;
1682
+ };
1683
+ export type BaasAuthResult = {
1684
+ authenticated?: boolean;
1685
+ walletAddress: string;
1686
+ chain: BaasSupportedChain;
1687
+ appId: string;
1688
+ token: string;
1689
+ expiresAt: number;
1690
+ };
1691
+ export type BaasSessionInfo = {
1692
+ valid: boolean;
1693
+ walletAddress?: string;
1694
+ chain?: BaasSupportedChain;
1695
+ appId?: string;
1696
+ permissions?: string[];
1697
+ sessionId?: string;
1698
+ expiresAt?: number;
1699
+ error?: string;
1700
+ };
1701
+ export type BaasDocument = {
1702
+ _id: string;
1703
+ data: Record<string, unknown>;
1704
+ createdAt: number;
1705
+ updatedAt: number;
1706
+ version: number;
1707
+ };
1708
+ export type BaasStateTransition = {
1709
+ transitionId: string;
1710
+ operation: "insert" | "update" | "delete";
1711
+ collection: string;
1712
+ documentId: string;
1713
+ previousHash: string;
1714
+ newHash: string;
1715
+ stateRoot: string;
1716
+ timestamp: number;
1717
+ proof: BaasMerkleProof;
1718
+ };
1719
+ export type BaasMerkleProof = {
1720
+ root: string;
1721
+ leaf: string;
1722
+ siblings: string[];
1723
+ path: ("left" | "right")[];
1724
+ };
1725
+ export type BaasInsertResult = {
1726
+ document: BaasDocument;
1727
+ stateTransition: BaasStateTransition;
1720
1728
  };
1721
- export type GatewayLivenessResponse = {
1722
- alive: boolean;
1723
- timestamp: string;
1729
+ export type BaasUpdateResult = {
1730
+ document: BaasDocument;
1731
+ stateTransition: BaasStateTransition;
1724
1732
  };
1725
- export type GatewayMetricsResponse = {
1726
- requests: {
1727
- total: number;
1728
- successful: number;
1729
- failed: number;
1730
- avgLatencyMs: number;
1731
- };
1732
- hosts: {
1733
- total: number;
1734
- healthy: number;
1735
- unhealthy: number;
1736
- };
1737
- bandwidth: {
1738
- inbound: number;
1739
- outbound: number;
1740
- };
1741
- timestamp: string;
1733
+ export type BaasDeleteResult = {
1734
+ deleted: boolean;
1735
+ stateTransition: BaasStateTransition;
1742
1736
  };
1743
- export type GatewayMetricsSummaryResponse = {
1744
- summary: Record<string, unknown>;
1745
- period: string;
1746
- generatedAt: string;
1737
+ export type BaasQueryOptions = {
1738
+ limit?: number;
1739
+ skip?: number;
1740
+ sort?: string;
1741
+ projection?: Record<string, 0 | 1>;
1747
1742
  };
1748
- export type RegisterHostRequest = {
1749
- name: string;
1750
- endpoint: string;
1751
- capabilities?: string[];
1752
- metadata?: Record<string, unknown>;
1743
+ export type BaasFindResult = {
1744
+ documents: BaasDocument[];
1745
+ count: number;
1746
+ limit: number;
1747
+ skip: number;
1753
1748
  };
1754
- export type HostInfo = {
1755
- hostId: string;
1756
- name: string;
1757
- endpoint: string;
1758
- status: "active" | "inactive" | "suspended";
1759
- verified: boolean;
1760
- capabilities: string[];
1761
- lastSeen: string;
1762
- registeredAt: string;
1763
- metadata?: Record<string, unknown>;
1749
+ export type BaasFileMetadata = {
1750
+ filename?: string;
1751
+ mimeType?: string;
1752
+ tags?: Record<string, string>;
1753
+ encrypted?: boolean;
1764
1754
  };
1765
- export type HostListResponse = {
1766
- hosts: HostInfo[];
1767
- total: number;
1755
+ export type BaasUploadResult = {
1756
+ cid: string;
1757
+ size: number;
1758
+ mimeType: string;
1759
+ uploadedAt: string;
1760
+ filename?: string;
1761
+ encrypted?: boolean;
1768
1762
  };
1769
- export type RoutingConfig = {
1770
- strategy: "round-robin" | "least-connections" | "random" | "weighted";
1771
- healthCheckInterval?: number;
1772
- timeout?: number;
1773
- retries?: number;
1774
- weights?: Record<string, number>;
1763
+ export type BaasFileInfo = {
1764
+ cid: string;
1765
+ filename?: string;
1766
+ size: number;
1767
+ mimeType?: string;
1768
+ uploadedAt: string;
1769
+ lastAccessedAt?: string;
1770
+ tags?: Record<string, string>;
1775
1771
  };
1776
- export type ProxyRequest = {
1777
- targetHostId?: string;
1778
- method: string;
1779
- path: string;
1780
- headers?: Record<string, string>;
1781
- body?: unknown;
1772
+ export type BaasStorageUsage = {
1773
+ totalSize: number;
1774
+ fileCount: number;
1782
1775
  };
1783
- export type ProxyResponse = {
1784
- statusCode: number;
1785
- headers: Record<string, string>;
1786
- body: unknown;
1787
- hostId: string;
1788
- latencyMs: number;
1776
+ export type BaasFunctionRuntime = "nodejs20" | "python3" | "deno";
1777
+ export type BaasTriggerType = "http" | "schedule" | "event" | "webhook";
1778
+ export type BaasFunctionResources = {
1779
+ memory: string;
1780
+ timeout: number;
1781
+ maxConcurrency?: number;
1789
1782
  };
1790
- export type RoutingStatsResponse = {
1791
- totalRequests: number;
1792
- successRate: number;
1793
- avgLatencyMs: number;
1794
- hostStats: Record<string, {
1795
- requests: number;
1796
- errors: number;
1797
- avgLatencyMs: number;
1783
+ export type BaasFunctionDeployRequest = {
1784
+ name: string;
1785
+ description?: string;
1786
+ runtime: BaasFunctionRuntime;
1787
+ code: string;
1788
+ codeType: "inline" | "ipfs";
1789
+ entryPoint?: string;
1790
+ triggers?: Array<{
1791
+ type: BaasTriggerType;
1792
+ config: Record<string, unknown>;
1798
1793
  }>;
1794
+ resources?: Partial<BaasFunctionResources>;
1795
+ environment?: Record<string, string>;
1799
1796
  };
1800
- export type DomainRegistrationRequest = {
1801
- domain: string;
1802
- owner: string;
1803
- registrar?: string;
1804
- autoRenew?: boolean;
1797
+ export type BaasFunctionDeployResult = {
1798
+ functionId: string;
1799
+ version: number;
1800
+ deployedAt: string;
1801
+ endpoints?: string[];
1802
+ status: "active" | "deploying" | "failed";
1803
+ error?: string;
1805
1804
  };
1806
- export type DomainInfo = {
1807
- domain: string;
1808
- owner: string;
1809
- status: "active" | "pending" | "suspended" | "expired";
1810
- verified: boolean;
1811
- registrar?: string;
1812
- expiresAt?: string;
1813
- createdAt: string;
1814
- dnsConfigured: boolean;
1815
- dnssecEnabled: boolean;
1805
+ export type BaasFunctionResult = {
1806
+ requestId: string;
1807
+ functionId: string;
1808
+ status: "success" | "error" | "timeout";
1809
+ result?: unknown;
1810
+ error?: string;
1811
+ logs?: string[];
1812
+ duration: number;
1813
+ memoryUsed?: number;
1816
1814
  };
1817
- export type DomainListResponse = {
1818
- domains: DomainInfo[];
1819
- total: number;
1815
+ export type BaasFunctionInfo = {
1816
+ functionId: string;
1817
+ name: string;
1818
+ runtime: BaasFunctionRuntime;
1819
+ version: number;
1820
+ status: "active" | "inactive" | "error";
1821
+ deployedAt: string;
1822
+ lastInvokedAt?: string;
1823
+ invocationCount: number;
1820
1824
  };
1821
- export type DomainAvailabilityResponse = {
1822
- domain: string;
1823
- available: boolean;
1824
- premium: boolean;
1825
- price?: string;
1826
- suggestions?: string[];
1825
+ export type BaasFunctionLog = {
1826
+ timestamp: string;
1827
+ level: "debug" | "info" | "warn" | "error";
1828
+ message: string;
1829
+ requestId?: string;
1830
+ metadata?: Record<string, unknown>;
1827
1831
  };
1828
- export type VerificationTokenResponse = {
1829
- token: string;
1830
- method: "dns" | "http" | "email";
1831
- instructions: string;
1832
- expiresAt: string;
1832
+ export type BaasFunctionLogOptions = {
1833
+ startTime?: string;
1834
+ endTime?: string;
1835
+ limit?: number;
1836
+ level?: "debug" | "info" | "warn" | "error";
1837
+ requestId?: string;
1833
1838
  };
1834
- export type VerificationResult = {
1835
- verified: boolean;
1836
- domain: string;
1837
- method: string;
1838
- verifiedAt?: string;
1839
- error?: string;
1839
+ export type BaasMessage = {
1840
+ messageId: string;
1841
+ channel: string;
1842
+ data: Record<string, unknown>;
1843
+ sender?: string;
1844
+ timestamp: string;
1845
+ metadata?: Record<string, unknown>;
1840
1846
  };
1841
- export type DnsRecord = {
1842
- type: "A" | "AAAA" | "CNAME" | "MX" | "TXT" | "NS" | "SRV" | "CAA";
1847
+ export type BaasChannelConfig = {
1843
1848
  name: string;
1844
- value: string;
1845
- ttl?: number;
1846
- priority?: number;
1849
+ persistent?: boolean;
1850
+ maxHistoryLength?: number;
1851
+ presence?: boolean;
1852
+ authRequired?: boolean;
1847
1853
  };
1848
- export type DomainTransferRequest = {
1849
- authCode: string;
1850
- newRegistrar?: string;
1854
+ export type BaasPresenceMember = {
1855
+ clientId: string;
1856
+ walletAddress?: string;
1857
+ joinedAt: string;
1858
+ lastSeenAt: string;
1859
+ metadata?: Record<string, unknown>;
1851
1860
  };
1852
- export type DnsResolveResponse = {
1853
- name: string;
1854
- type: string;
1855
- records: Array<{
1856
- value: string;
1857
- ttl: number;
1858
- }>;
1859
- dnssec: boolean;
1861
+ export type BaasPresenceInfo = {
1862
+ channel: string;
1863
+ members: BaasPresenceMember[];
1864
+ totalCount: number;
1865
+ };
1866
+ export type BaasHistoryOptions = {
1867
+ limit?: number;
1868
+ before?: string;
1869
+ after?: string;
1870
+ startTime?: string;
1871
+ endTime?: string;
1872
+ };
1873
+ export type BaasPublishResult = {
1874
+ messageId: string;
1875
+ channel: string;
1860
1876
  timestamp: string;
1861
1877
  };
1862
- export type DnsBatchQuery = {
1863
- name: string;
1864
- type?: string;
1878
+ export type BaasInitRequest = {
1879
+ name: string;
1880
+ port: number;
1881
+ services: BaasService[];
1882
+ limits?: {
1883
+ cpu?: string;
1884
+ memory?: string;
1885
+ };
1886
+ };
1887
+ export type BaasInitResponse = {
1888
+ appId: string;
1889
+ registry: {
1890
+ server: string;
1891
+ username: string;
1892
+ password: string;
1893
+ repository: string;
1894
+ };
1865
1895
  };
1866
- export type DnsBatchResolveResponse = {
1867
- results: DnsResolveResponse[];
1868
- errors: Array<{
1869
- query: DnsBatchQuery;
1870
- error: string;
1871
- }>;
1896
+ export type BaasDeployRequest = {
1897
+ tag: string;
1898
+ port?: number;
1899
+ replicas?: number;
1900
+ env?: Record<string, string>;
1901
+ resources?: {
1902
+ cpu?: string;
1903
+ memory?: string;
1904
+ };
1905
+ strategy?: "rolling" | "recreate";
1872
1906
  };
1873
- export type DnsZone = {
1874
- zoneName: string;
1875
- status: "active" | "pending" | "disabled";
1876
- records: number;
1877
- dnssecEnabled: boolean;
1878
- createdAt: string;
1879
- updatedAt: string;
1907
+ export type BaasDeployResponse = {
1908
+ appId: string;
1909
+ status: string;
1910
+ url: string;
1880
1911
  };
1881
- export type DnsZoneListResponse = {
1882
- zones: DnsZone[];
1883
- total: number;
1912
+ export type BaasUploadFrontendResponse = {
1913
+ bundleSha256: string;
1914
+ bundleSizeBytes: number;
1884
1915
  };
1885
- export type DnsRecordInfo = {
1886
- recordId: string;
1887
- type: string;
1888
- name: string;
1889
- value: string;
1890
- ttl: number;
1891
- priority?: number;
1892
- createdAt: string;
1893
- updatedAt: string;
1916
+ export type BaasRollbackRequest = {
1917
+ toTag: string;
1894
1918
  };
1895
- export type DnssecKey = {
1896
- keyTag: number;
1897
- algorithm: string;
1898
- digestType: string;
1899
- digest: string;
1900
- publicKey: string;
1901
- flags: number;
1919
+ export type BaasRuntimeStatus = {
1920
+ appId: string;
1921
+ state: "PENDING_SUBSCRIPTION" | "ACTIVE" | "SUSPENDED" | "RETIRED";
1922
+ runtime?: {
1923
+ image: string;
1924
+ runtimeState: "NOT_DEPLOYED" | "DEPLOYING" | "RUNNING" | "FAILED" | "DEGRADED";
1925
+ replicas: number;
1926
+ lastReconciledAt?: string;
1927
+ lastError?: string;
1928
+ };
1902
1929
  };
1903
- export type DnssecDsRecord = {
1904
- keyTag: number;
1905
- algorithm: number;
1906
- digestType: number;
1907
- digest: string;
1930
+ export type BaasAppListResponse = {
1931
+ apps: DeployedAppInfo[];
1908
1932
  };
1909
- declare class RoutingClient {
1910
- private readonly http;
1911
- constructor(http: HttpClient);
1912
- registerHost(request: RegisterHostRequest): Promise<HostInfo>;
1913
- unregisterHost(hostId: string): Promise<{
1914
- success: boolean;
1915
- }>;
1916
- getAllHosts(): Promise<HostListResponse>;
1917
- getVerifiedHosts(): Promise<HostListResponse>;
1918
- getHost(hostId: string): Promise<HostInfo>;
1919
- verifyHost(hostId: string): Promise<{
1920
- verified: boolean;
1921
- message: string;
1922
- }>;
1923
- setRoutingConfig(appId: string, config: RoutingConfig): Promise<RoutingConfig>;
1924
- getRoutingConfig(appId: string): Promise<RoutingConfig>;
1925
- proxyRequest(request: ProxyRequest): Promise<ProxyResponse>;
1926
- getStats(): Promise<RoutingStatsResponse>;
1927
- mapDomainToApp(domain: string, appId: string): Promise<{
1928
- success: boolean;
1929
- domain: string;
1930
- appId: string;
1931
- }>;
1932
- }
1933
- declare class DomainsClient {
1933
+ declare class DeploymentClient {
1934
1934
  private readonly http;
1935
1935
  constructor(http: HttpClient);
1936
- register(request: DomainRegistrationRequest): Promise<DomainInfo>;
1937
- checkAvailability(domain: string): Promise<DomainAvailabilityResponse>;
1938
- getInfo(domain: string): Promise<DomainInfo>;
1939
- list(owner?: string): Promise<DomainListResponse>;
1940
- generateVerificationToken(domain: string, method: "dns" | "http" | "email"): Promise<VerificationTokenResponse>;
1941
- verifyOwnership(domain: string, token: string): Promise<VerificationResult>;
1942
- configureDns(domain: string, records: DnsRecord[]): Promise<{
1943
- success: boolean;
1944
- records: DnsRecord[];
1945
- }>;
1946
- enableDnssec(domain: string): Promise<{
1947
- success: boolean;
1948
- message: string;
1949
- }>;
1950
- disableDnssec(domain: string): Promise<{
1951
- success: boolean;
1952
- message: string;
1953
- }>;
1954
- renew(domain: string, years?: number): Promise<DomainInfo>;
1955
- transfer(domain: string, request: DomainTransferRequest): Promise<{
1956
- success: boolean;
1957
- message: string;
1958
- }>;
1959
- approveTransfer(domain: string): Promise<{
1936
+ init(request: BaasInitRequest): Promise<BaasInitResponse>;
1937
+ uploadFrontend(appId: string, bundle: Blob | Buffer, filename?: string): Promise<BaasUploadFrontendResponse>;
1938
+ deploy(appId: string, request: BaasDeployRequest): Promise<BaasDeployResponse>;
1939
+ rollback(appId: string, request: BaasRollbackRequest): Promise<BaasDeployResponse>;
1940
+ status(appId: string): Promise<BaasRuntimeStatus>;
1941
+ list(): Promise<BaasAppListResponse>;
1942
+ get(appId: string): Promise<DeployedAppInfo>;
1943
+ update(appId: string, updates: Partial<BaasDeployRequest>): Promise<DeployedAppInfo>;
1944
+ delete(appId: string): Promise<{
1960
1945
  success: boolean;
1961
1946
  }>;
1962
- rejectTransfer(domain: string): Promise<{
1947
+ suspend(appId: string): Promise<{
1963
1948
  success: boolean;
1949
+ status: string;
1964
1950
  }>;
1965
- suspend(domain: string, reason: string): Promise<{
1951
+ resume(appId: string): Promise<{
1966
1952
  success: boolean;
1953
+ status: string;
1967
1954
  }>;
1968
- unsuspend(domain: string): Promise<{
1969
- success: boolean;
1955
+ getStats(): Promise<{
1956
+ totalApps: number;
1957
+ activeApps: number;
1958
+ totalOwners: number;
1970
1959
  }>;
1971
1960
  }
1972
- declare class DnsClient {
1961
+ export interface SmartEngineClientConfig {
1962
+ baseUrl: string;
1963
+ apiKey?: string;
1964
+ authToken?: string;
1965
+ timeout?: number;
1966
+ allowInsecure?: boolean;
1967
+ http?: ResilientHttpConfig;
1968
+ }
1969
+ export interface NetworkConnectionConfig {
1970
+ network: "mainnet" | "testnet" | "previewnet";
1971
+ registryTopicId: string;
1972
+ chain: AuthChain;
1973
+ address: string;
1974
+ publicKey: string;
1975
+ signFn: (challenge: string) => string | Promise<string>;
1976
+ metadata?: {
1977
+ appId?: string;
1978
+ appName?: string;
1979
+ };
1980
+ mirrorNodeUrl?: string;
1981
+ allowInsecure?: boolean;
1982
+ }
1983
+ export interface ClusterConnectionConfig {
1984
+ bootstrap: string[];
1985
+ chain: AuthChain;
1986
+ address: string;
1987
+ publicKey: string;
1988
+ signFn: (challenge: string) => string | Promise<string>;
1989
+ metadata?: {
1990
+ appId?: string;
1991
+ appName?: string;
1992
+ };
1993
+ trustAnchor?: {
1994
+ network: "mainnet" | "testnet" | "previewnet";
1995
+ registryTopicId: string;
1996
+ mirrorNodeUrl?: string;
1997
+ };
1998
+ allowInsecure?: boolean;
1999
+ }
2000
+ export interface ClusterConnectionResult {
2001
+ client: SmartEngineClient;
2002
+ cluster: ClusterInfo;
2003
+ session: AuthenticateResponse;
2004
+ }
2005
+ export interface NetworkConnectionResult {
2006
+ client: SmartEngineClient;
2007
+ validator: ValidatorInfo;
2008
+ session: AuthenticateResponse;
2009
+ }
2010
+ declare class SmartEngineClient {
2011
+ private baseUrl;
2012
+ private allowInsecure;
1973
2013
  private readonly http;
1974
- constructor(http: HttpClient);
1975
- resolve(name: string, type?: string, dnssec?: boolean): Promise<DnsResolveResponse>;
1976
- resolveBatch(queries: DnsBatchQuery[]): Promise<DnsBatchResolveResponse>;
1977
- listZones(): Promise<DnsZoneListResponse>;
1978
- getZone(zoneName: string): Promise<DnsZone & {
1979
- records: DnsRecordInfo[];
2014
+ private readonly txHttp;
2015
+ private lastHttpError?;
2016
+ readonly subscription: SubscriptionClient;
2017
+ readonly tss: TSSClient;
2018
+ readonly ipfs: IPFSClient;
2019
+ readonly transactions: TransactionsClient;
2020
+ readonly hedera: HederaTransactionsClient;
2021
+ readonly xrpl: XrplTransactionsClient;
2022
+ readonly solana: SolanaTransactionsClient;
2023
+ readonly polkadot: PolkadotTransactionsClient;
2024
+ readonly snapshots: SnapshotsClient;
2025
+ readonly historicalBalance: HistoricalBalanceClient;
2026
+ readonly settlement: SettlementClient;
2027
+ readonly governance: GovernanceClient;
2028
+ readonly personhood: PersonhoodClient;
2029
+ readonly agents: AgentsClient;
2030
+ readonly deployments: DeploymentClient;
2031
+ constructor(config: SmartEngineClientConfig);
2032
+ static fromEnv(env: Record<string, string | undefined>): SmartEngineClient;
2033
+ static connectToNetwork(config: NetworkConnectionConfig): Promise<NetworkConnectionResult>;
2034
+ static connectToCluster(config: ClusterConnectionConfig): Promise<ClusterConnectionResult>;
2035
+ getBaseUrl(): string;
2036
+ isAuthenticated(): boolean;
2037
+ getHttpHealth(): {
2038
+ breaker: CircuitBreakerSnapshot | null;
2039
+ lastError?: Error;
2040
+ };
2041
+ getHealth(): Promise<{
2042
+ status: string;
2043
+ timestamp: string;
2044
+ chains: any[];
1980
2045
  }>;
1981
- createZone(request: {
1982
- zoneName: string;
1983
- description?: string;
1984
- }): Promise<DnsZone>;
1985
- deleteZone(zoneName: string): Promise<{
1986
- success: boolean;
2046
+ getSupportedChains(): Promise<{
2047
+ chains: string[];
2048
+ }>;
2049
+ createAccount(request: CreateAccountRequest): Promise<CreateAccountResponse>;
2050
+ getAccountInfo(chain: string, accountId: string): Promise<AccountInfo>;
2051
+ getBalance(chain: string, accountId: string): Promise<AccountBalance>;
2052
+ transfer(request: TransferRequest): Promise<TransferResponse>;
2053
+ getTransaction(chain: string, txId: string): Promise<Transaction>;
2054
+ getTransactionReceipt(chain: string, txId: string): Promise<any>;
2055
+ createToken(request: CreateTokenRequest): Promise<CreateTokenResponse>;
2056
+ mintToken(request: MintTokenRequest): Promise<any>;
2057
+ getTokenInfo(chain: string, tokenId: string): Promise<TokenInfo>;
2058
+ burnToken(request: BurnTokenRequest): Promise<ActionResult>;
2059
+ pauseToken(request: TokenActionRequest): Promise<ActionResult>;
2060
+ unpauseToken(request: TokenActionRequest): Promise<ActionResult>;
2061
+ restrictAccount(request: TokenActionRequest): Promise<ActionResult>;
2062
+ unrestrictAccount(request: TokenActionRequest): Promise<ActionResult>;
2063
+ enableCompliance(request: TokenActionRequest): Promise<ActionResult>;
2064
+ disableCompliance(request: TokenActionRequest): Promise<ActionResult>;
2065
+ wipeFromAccount(request: TokenActionRequest): Promise<ActionResult>;
2066
+ getAllCapabilities(): Promise<any>;
2067
+ getChainCapabilities(chain: ChainType): Promise<any>;
2068
+ getSystemStatus(): Promise<any>;
2069
+ submitMessage(chain: string, topicId: string, message: string): Promise<any>;
2070
+ getClusterHealth(): Promise<{
2071
+ status: string;
2072
+ nodes: number;
2073
+ healthy: number;
2074
+ unhealthy: number;
1987
2075
  }>;
1988
- addRecord(zoneName: string, record: DnsRecord): Promise<DnsRecordInfo>;
1989
- updateRecord(zoneName: string, recordId: string, updates: Partial<DnsRecord>): Promise<DnsRecordInfo>;
1990
- deleteRecord(zoneName: string, recordId: string): Promise<{
1991
- success: boolean;
2076
+ getClusterStatus(): Promise<{
2077
+ status: string;
2078
+ nodeId: string;
2079
+ nodes: Array<{
2080
+ nodeId: string;
2081
+ endpoint: string;
2082
+ status: string;
2083
+ lastSeen?: string;
2084
+ }>;
2085
+ quorum: {
2086
+ required: number;
2087
+ current: number;
2088
+ reached: boolean;
2089
+ };
1992
2090
  }>;
1993
- generateDnssecKeys(zoneName: string, algorithm?: string): Promise<{
1994
- keys: DnssecKey[];
2091
+ getMetrics(): Promise<string>;
2092
+ getQueueStats(): Promise<{
2093
+ queues: Record<string, {
2094
+ pending: number;
2095
+ processing: number;
2096
+ completed: number;
2097
+ failed: number;
2098
+ }>;
2099
+ timestamp: string;
1995
2100
  }>;
1996
- getDnssecKeys(zoneName: string): Promise<{
1997
- keys: DnssecKey[];
2101
+ getCircuitBreakerStatus(): Promise<{
2102
+ breakers: Record<string, {
2103
+ state: "closed" | "open" | "half-open";
2104
+ failures: number;
2105
+ successes: number;
2106
+ lastFailure?: string;
2107
+ nextRetry?: string;
2108
+ }>;
2109
+ timestamp: string;
1998
2110
  }>;
1999
- getDsRecord(zoneName: string): Promise<DnssecDsRecord>;
2000
- clearCache(): Promise<{
2001
- success: boolean;
2002
- entriesCleared: number;
2111
+ verifySignature(request: {
2112
+ chain: ChainType;
2113
+ message: string;
2114
+ signature: string;
2115
+ publicKey: string;
2116
+ }): Promise<{
2117
+ valid: boolean;
2118
+ chain: ChainType;
2003
2119
  }>;
2004
2120
  }
2005
- export type SmartGatewayClientConfig = {
2006
- baseUrl: string;
2007
- apiKey?: string;
2008
- authToken?: string;
2009
- timeout?: number;
2010
- allowInsecure?: boolean;
2011
- };
2012
- declare class SmartGatewayClient {
2013
- private readonly http;
2014
- readonly routing: RoutingClient;
2015
- readonly domains: DomainsClient;
2016
- readonly dns: DnsClient;
2017
- constructor(config: SmartGatewayClientConfig);
2018
- getHealth(): Promise<GatewayHealthResponse>;
2019
- getStatus(): Promise<GatewayStatusResponse>;
2020
- getReadiness(): Promise<GatewayReadinessResponse>;
2021
- getLiveness(): Promise<GatewayLivenessResponse>;
2022
- getMetrics(refresh?: boolean): Promise<GatewayMetricsResponse>;
2023
- getMetricsSummary(): Promise<GatewayMetricsSummaryResponse>;
2024
- }
2025
- export type BaasService = "auth" | "database" | "storage" | "functions" | "messaging";
2026
- export type BaasSupportedChain = "hedera" | "xrpl" | "polkadot" | "solana";
2027
- export type BaasEndpoints = {
2028
- auth: string;
2029
- database: string;
2030
- storage: string;
2031
- functions: string;
2032
- messaging: string;
2033
- };
2034
- export type DeployedAppInfo = {
2035
- appId: string;
2036
- name: string;
2037
- status: "active" | "inactive" | "deploying" | "error";
2038
- services: string[];
2039
- endpoints: BaasEndpoints;
2040
- createdAt: string;
2041
- };
2042
- export type BaasAuthConfig = {
2043
- chain: BaasSupportedChain;
2044
- walletAddress: string;
2045
- publicKey: string;
2046
- signFn: (message: string) => string | Promise<string>;
2047
- };
2048
- export type BaasClientConfig = {
2049
- hostUrl: string;
2050
- appId?: string;
2051
- appName?: string;
2052
- auth?: BaasAuthConfig;
2053
- services?: BaasService[];
2054
- timeout?: number;
2055
- allowInsecure?: boolean;
2056
- http?: ResilientHttpConfig;
2057
- pathPrefix?: string;
2058
- };
2059
- export type BaasAuthResult = {
2060
- authenticated?: boolean;
2061
- walletAddress: string;
2062
- chain: BaasSupportedChain;
2063
- appId: string;
2064
- token: string;
2065
- expiresAt: number;
2066
- };
2067
- export type BaasSessionInfo = {
2068
- valid: boolean;
2069
- walletAddress?: string;
2070
- chain?: BaasSupportedChain;
2071
- appId?: string;
2072
- permissions?: string[];
2073
- sessionId?: string;
2074
- expiresAt?: number;
2075
- error?: string;
2076
- };
2077
- export type BaasDocument = {
2078
- _id: string;
2079
- data: Record<string, unknown>;
2080
- createdAt: number;
2081
- updatedAt: number;
2082
- version: number;
2083
- };
2084
- export type BaasStateTransition = {
2085
- transitionId: string;
2086
- operation: "insert" | "update" | "delete";
2087
- collection: string;
2088
- documentId: string;
2089
- previousHash: string;
2090
- newHash: string;
2091
- stateRoot: string;
2092
- timestamp: number;
2093
- proof: BaasMerkleProof;
2121
+ export type GatewayHealthResponse = {
2122
+ status: "healthy" | "degraded" | "unhealthy";
2123
+ timestamp: string;
2124
+ uptime: number;
2125
+ version: string;
2094
2126
  };
2095
- export type BaasMerkleProof = {
2096
- root: string;
2097
- leaf: string;
2098
- siblings: string[];
2099
- path: ("left" | "right")[];
2127
+ export type GatewayStatusResponse = {
2128
+ status: string;
2129
+ hosts: {
2130
+ total: number;
2131
+ verified: number;
2132
+ active: number;
2133
+ };
2134
+ domains: {
2135
+ total: number;
2136
+ verified: number;
2137
+ };
2138
+ uptime: number;
2100
2139
  };
2101
- export type BaasInsertResult = {
2102
- document: BaasDocument;
2103
- stateTransition: BaasStateTransition;
2140
+ export type GatewayReadinessResponse = {
2141
+ ready: boolean;
2142
+ checks: Record<string, boolean>;
2104
2143
  };
2105
- export type BaasUpdateResult = {
2106
- document: BaasDocument;
2107
- stateTransition: BaasStateTransition;
2144
+ export type GatewayLivenessResponse = {
2145
+ alive: boolean;
2146
+ timestamp: string;
2108
2147
  };
2109
- export type BaasDeleteResult = {
2110
- deleted: boolean;
2111
- stateTransition: BaasStateTransition;
2148
+ export type GatewayMetricsResponse = {
2149
+ requests: {
2150
+ total: number;
2151
+ successful: number;
2152
+ failed: number;
2153
+ avgLatencyMs: number;
2154
+ };
2155
+ hosts: {
2156
+ total: number;
2157
+ healthy: number;
2158
+ unhealthy: number;
2159
+ };
2160
+ bandwidth: {
2161
+ inbound: number;
2162
+ outbound: number;
2163
+ };
2164
+ timestamp: string;
2112
2165
  };
2113
- export type BaasQueryOptions = {
2114
- limit?: number;
2115
- skip?: number;
2116
- sort?: string;
2117
- projection?: Record<string, 0 | 1>;
2166
+ export type GatewayMetricsSummaryResponse = {
2167
+ summary: Record<string, unknown>;
2168
+ period: string;
2169
+ generatedAt: string;
2118
2170
  };
2119
- export type BaasFindResult = {
2120
- documents: BaasDocument[];
2121
- count: number;
2122
- limit: number;
2123
- skip: number;
2171
+ export type RegisterHostRequest = {
2172
+ name: string;
2173
+ endpoint: string;
2174
+ capabilities?: string[];
2175
+ metadata?: Record<string, unknown>;
2124
2176
  };
2125
- export type BaasFileMetadata = {
2126
- filename?: string;
2127
- mimeType?: string;
2128
- tags?: Record<string, string>;
2129
- encrypted?: boolean;
2177
+ export type HostInfo = {
2178
+ hostId: string;
2179
+ name: string;
2180
+ endpoint: string;
2181
+ status: "active" | "inactive" | "suspended";
2182
+ verified: boolean;
2183
+ capabilities: string[];
2184
+ lastSeen: string;
2185
+ registeredAt: string;
2186
+ metadata?: Record<string, unknown>;
2130
2187
  };
2131
- export type BaasUploadResult = {
2132
- cid: string;
2133
- size: number;
2134
- mimeType: string;
2135
- uploadedAt: string;
2136
- filename?: string;
2137
- encrypted?: boolean;
2188
+ export type HostListResponse = {
2189
+ hosts: HostInfo[];
2190
+ total: number;
2138
2191
  };
2139
- export type BaasFileInfo = {
2140
- cid: string;
2141
- filename?: string;
2142
- size: number;
2143
- mimeType?: string;
2144
- uploadedAt: string;
2145
- lastAccessedAt?: string;
2146
- tags?: Record<string, string>;
2192
+ export type RoutingConfig = {
2193
+ strategy: "round-robin" | "least-connections" | "random" | "weighted";
2194
+ healthCheckInterval?: number;
2195
+ timeout?: number;
2196
+ retries?: number;
2197
+ weights?: Record<string, number>;
2147
2198
  };
2148
- export type BaasStorageUsage = {
2149
- totalSize: number;
2150
- fileCount: number;
2199
+ export type ProxyRequest = {
2200
+ targetHostId?: string;
2201
+ method: string;
2202
+ path: string;
2203
+ headers?: Record<string, string>;
2204
+ body?: unknown;
2151
2205
  };
2152
- export type BaasFunctionRuntime = "nodejs20" | "python3" | "deno";
2153
- export type BaasTriggerType = "http" | "schedule" | "event" | "webhook";
2154
- export type BaasFunctionResources = {
2155
- memory: string;
2156
- timeout: number;
2157
- maxConcurrency?: number;
2206
+ export type ProxyResponse = {
2207
+ statusCode: number;
2208
+ headers: Record<string, string>;
2209
+ body: unknown;
2210
+ hostId: string;
2211
+ latencyMs: number;
2158
2212
  };
2159
- export type BaasFunctionDeployRequest = {
2160
- name: string;
2161
- description?: string;
2162
- runtime: BaasFunctionRuntime;
2163
- code: string;
2164
- codeType: "inline" | "ipfs";
2165
- entryPoint?: string;
2166
- triggers?: Array<{
2167
- type: BaasTriggerType;
2168
- config: Record<string, unknown>;
2213
+ export type RoutingStatsResponse = {
2214
+ totalRequests: number;
2215
+ successRate: number;
2216
+ avgLatencyMs: number;
2217
+ hostStats: Record<string, {
2218
+ requests: number;
2219
+ errors: number;
2220
+ avgLatencyMs: number;
2169
2221
  }>;
2170
- resources?: Partial<BaasFunctionResources>;
2171
- environment?: Record<string, string>;
2172
2222
  };
2173
- export type BaasFunctionDeployResult = {
2174
- functionId: string;
2175
- version: number;
2176
- deployedAt: string;
2177
- endpoints?: string[];
2178
- status: "active" | "deploying" | "failed";
2179
- error?: string;
2223
+ export type DomainRegistrationRequest = {
2224
+ domain: string;
2225
+ owner: string;
2226
+ registrar?: string;
2227
+ autoRenew?: boolean;
2180
2228
  };
2181
- export type BaasFunctionResult = {
2182
- requestId: string;
2183
- functionId: string;
2184
- status: "success" | "error" | "timeout";
2185
- result?: unknown;
2186
- error?: string;
2187
- logs?: string[];
2188
- duration: number;
2189
- memoryUsed?: number;
2229
+ export type DomainInfo = {
2230
+ domain: string;
2231
+ owner: string;
2232
+ status: "active" | "pending" | "suspended" | "expired";
2233
+ verified: boolean;
2234
+ registrar?: string;
2235
+ expiresAt?: string;
2236
+ createdAt: string;
2237
+ dnsConfigured: boolean;
2238
+ dnssecEnabled: boolean;
2190
2239
  };
2191
- export type BaasFunctionInfo = {
2192
- functionId: string;
2193
- name: string;
2194
- runtime: BaasFunctionRuntime;
2195
- version: number;
2196
- status: "active" | "inactive" | "error";
2197
- deployedAt: string;
2198
- lastInvokedAt?: string;
2199
- invocationCount: number;
2240
+ export type DomainListResponse = {
2241
+ domains: DomainInfo[];
2242
+ total: number;
2200
2243
  };
2201
- export type BaasFunctionLog = {
2202
- timestamp: string;
2203
- level: "debug" | "info" | "warn" | "error";
2204
- message: string;
2205
- requestId?: string;
2206
- metadata?: Record<string, unknown>;
2244
+ export type DomainAvailabilityResponse = {
2245
+ domain: string;
2246
+ available: boolean;
2247
+ premium: boolean;
2248
+ price?: string;
2249
+ suggestions?: string[];
2207
2250
  };
2208
- export type BaasFunctionLogOptions = {
2209
- startTime?: string;
2210
- endTime?: string;
2211
- limit?: number;
2212
- level?: "debug" | "info" | "warn" | "error";
2213
- requestId?: string;
2251
+ export type VerificationTokenResponse = {
2252
+ token: string;
2253
+ method: "dns" | "http" | "email";
2254
+ instructions: string;
2255
+ expiresAt: string;
2214
2256
  };
2215
- export type BaasMessage = {
2216
- messageId: string;
2217
- channel: string;
2218
- data: Record<string, unknown>;
2219
- sender?: string;
2220
- timestamp: string;
2221
- metadata?: Record<string, unknown>;
2257
+ export type VerificationResult = {
2258
+ verified: boolean;
2259
+ domain: string;
2260
+ method: string;
2261
+ verifiedAt?: string;
2262
+ error?: string;
2222
2263
  };
2223
- export type BaasChannelConfig = {
2264
+ export type DnsRecord = {
2265
+ type: "A" | "AAAA" | "CNAME" | "MX" | "TXT" | "NS" | "SRV" | "CAA";
2224
2266
  name: string;
2225
- persistent?: boolean;
2226
- maxHistoryLength?: number;
2227
- presence?: boolean;
2228
- authRequired?: boolean;
2229
- };
2230
- export type BaasPresenceMember = {
2231
- clientId: string;
2232
- walletAddress?: string;
2233
- joinedAt: string;
2234
- lastSeenAt: string;
2235
- metadata?: Record<string, unknown>;
2236
- };
2237
- export type BaasPresenceInfo = {
2238
- channel: string;
2239
- members: BaasPresenceMember[];
2240
- totalCount: number;
2267
+ value: string;
2268
+ ttl?: number;
2269
+ priority?: number;
2241
2270
  };
2242
- export type BaasHistoryOptions = {
2243
- limit?: number;
2244
- before?: string;
2245
- after?: string;
2246
- startTime?: string;
2247
- endTime?: string;
2271
+ export type DomainTransferRequest = {
2272
+ authCode: string;
2273
+ newRegistrar?: string;
2248
2274
  };
2249
- export type BaasPublishResult = {
2250
- messageId: string;
2251
- channel: string;
2275
+ export type DnsResolveResponse = {
2276
+ name: string;
2277
+ type: string;
2278
+ records: Array<{
2279
+ value: string;
2280
+ ttl: number;
2281
+ }>;
2282
+ dnssec: boolean;
2252
2283
  timestamp: string;
2253
2284
  };
2254
- export type BaasInitRequest = {
2285
+ export type DnsBatchQuery = {
2255
2286
  name: string;
2256
- port: number;
2257
- services: BaasService[];
2258
- limits?: {
2259
- cpu?: string;
2260
- memory?: string;
2261
- };
2287
+ type?: string;
2262
2288
  };
2263
- export type BaasInitResponse = {
2264
- appId: string;
2265
- registry: {
2266
- server: string;
2267
- username: string;
2268
- password: string;
2269
- repository: string;
2270
- };
2289
+ export type DnsBatchResolveResponse = {
2290
+ results: DnsResolveResponse[];
2291
+ errors: Array<{
2292
+ query: DnsBatchQuery;
2293
+ error: string;
2294
+ }>;
2271
2295
  };
2272
- export type BaasDeployRequest = {
2273
- tag: string;
2274
- replicas?: number;
2275
- env?: Record<string, string>;
2276
- resources?: {
2277
- cpu?: string;
2278
- memory?: string;
2279
- };
2280
- strategy?: "rolling" | "recreate";
2296
+ export type DnsZone = {
2297
+ zoneName: string;
2298
+ status: "active" | "pending" | "disabled";
2299
+ records: number;
2300
+ dnssecEnabled: boolean;
2301
+ createdAt: string;
2302
+ updatedAt: string;
2281
2303
  };
2282
- export type BaasDeployResponse = {
2283
- appId: string;
2284
- status: string;
2285
- url: string;
2304
+ export type DnsZoneListResponse = {
2305
+ zones: DnsZone[];
2306
+ total: number;
2286
2307
  };
2287
- export type BaasUploadFrontendResponse = {
2288
- bundleSha256: string;
2289
- bundleSizeBytes: number;
2308
+ export type DnsRecordInfo = {
2309
+ recordId: string;
2310
+ type: string;
2311
+ name: string;
2312
+ value: string;
2313
+ ttl: number;
2314
+ priority?: number;
2315
+ createdAt: string;
2316
+ updatedAt: string;
2290
2317
  };
2291
- export type BaasRollbackRequest = {
2292
- toTag: string;
2318
+ export type DnssecKey = {
2319
+ keyTag: number;
2320
+ algorithm: string;
2321
+ digestType: string;
2322
+ digest: string;
2323
+ publicKey: string;
2324
+ flags: number;
2293
2325
  };
2294
- export type BaasRuntimeStatus = {
2295
- appId: string;
2296
- state: "PENDING_SUBSCRIPTION" | "ACTIVE" | "SUSPENDED" | "RETIRED";
2297
- runtime?: {
2298
- image: string;
2299
- runtimeState: "NOT_DEPLOYED" | "DEPLOYING" | "RUNNING" | "FAILED" | "DEGRADED";
2300
- replicas: number;
2301
- lastReconciledAt?: string;
2302
- lastError?: string;
2303
- };
2326
+ export type DnssecDsRecord = {
2327
+ keyTag: number;
2328
+ algorithm: number;
2329
+ digestType: number;
2330
+ digest: string;
2304
2331
  };
2305
- export type BaasAppListResponse = {
2306
- apps: DeployedAppInfo[];
2332
+ declare class RoutingClient {
2333
+ private readonly http;
2334
+ constructor(http: HttpClient);
2335
+ registerHost(request: RegisterHostRequest): Promise<HostInfo>;
2336
+ unregisterHost(hostId: string): Promise<{
2337
+ success: boolean;
2338
+ }>;
2339
+ getAllHosts(): Promise<HostListResponse>;
2340
+ getVerifiedHosts(): Promise<HostListResponse>;
2341
+ getHost(hostId: string): Promise<HostInfo>;
2342
+ verifyHost(hostId: string): Promise<{
2343
+ verified: boolean;
2344
+ message: string;
2345
+ }>;
2346
+ setRoutingConfig(appId: string, config: RoutingConfig): Promise<RoutingConfig>;
2347
+ getRoutingConfig(appId: string): Promise<RoutingConfig>;
2348
+ proxyRequest(request: ProxyRequest): Promise<ProxyResponse>;
2349
+ getStats(): Promise<RoutingStatsResponse>;
2350
+ mapDomainToApp(domain: string, appId: string): Promise<{
2351
+ success: boolean;
2352
+ domain: string;
2353
+ appId: string;
2354
+ }>;
2355
+ }
2356
+ declare class DomainsClient {
2357
+ private readonly http;
2358
+ constructor(http: HttpClient);
2359
+ register(request: DomainRegistrationRequest): Promise<DomainInfo>;
2360
+ checkAvailability(domain: string): Promise<DomainAvailabilityResponse>;
2361
+ getInfo(domain: string): Promise<DomainInfo>;
2362
+ list(owner?: string): Promise<DomainListResponse>;
2363
+ generateVerificationToken(domain: string, method: "dns" | "http" | "email"): Promise<VerificationTokenResponse>;
2364
+ verifyOwnership(domain: string, token: string): Promise<VerificationResult>;
2365
+ configureDns(domain: string, records: DnsRecord[]): Promise<{
2366
+ success: boolean;
2367
+ records: DnsRecord[];
2368
+ }>;
2369
+ enableDnssec(domain: string): Promise<{
2370
+ success: boolean;
2371
+ message: string;
2372
+ }>;
2373
+ disableDnssec(domain: string): Promise<{
2374
+ success: boolean;
2375
+ message: string;
2376
+ }>;
2377
+ renew(domain: string, years?: number): Promise<DomainInfo>;
2378
+ transfer(domain: string, request: DomainTransferRequest): Promise<{
2379
+ success: boolean;
2380
+ message: string;
2381
+ }>;
2382
+ approveTransfer(domain: string): Promise<{
2383
+ success: boolean;
2384
+ }>;
2385
+ rejectTransfer(domain: string): Promise<{
2386
+ success: boolean;
2387
+ }>;
2388
+ suspend(domain: string, reason: string): Promise<{
2389
+ success: boolean;
2390
+ }>;
2391
+ unsuspend(domain: string): Promise<{
2392
+ success: boolean;
2393
+ }>;
2394
+ }
2395
+ declare class DnsClient {
2396
+ private readonly http;
2397
+ constructor(http: HttpClient);
2398
+ resolve(name: string, type?: string, dnssec?: boolean): Promise<DnsResolveResponse>;
2399
+ resolveBatch(queries: DnsBatchQuery[]): Promise<DnsBatchResolveResponse>;
2400
+ listZones(): Promise<DnsZoneListResponse>;
2401
+ getZone(zoneName: string): Promise<DnsZone & {
2402
+ records: DnsRecordInfo[];
2403
+ }>;
2404
+ createZone(request: {
2405
+ zoneName: string;
2406
+ description?: string;
2407
+ }): Promise<DnsZone>;
2408
+ deleteZone(zoneName: string): Promise<{
2409
+ success: boolean;
2410
+ }>;
2411
+ addRecord(zoneName: string, record: DnsRecord): Promise<DnsRecordInfo>;
2412
+ updateRecord(zoneName: string, recordId: string, updates: Partial<DnsRecord>): Promise<DnsRecordInfo>;
2413
+ deleteRecord(zoneName: string, recordId: string): Promise<{
2414
+ success: boolean;
2415
+ }>;
2416
+ generateDnssecKeys(zoneName: string, algorithm?: string): Promise<{
2417
+ keys: DnssecKey[];
2418
+ }>;
2419
+ getDnssecKeys(zoneName: string): Promise<{
2420
+ keys: DnssecKey[];
2421
+ }>;
2422
+ getDsRecord(zoneName: string): Promise<DnssecDsRecord>;
2423
+ clearCache(): Promise<{
2424
+ success: boolean;
2425
+ entriesCleared: number;
2426
+ }>;
2427
+ }
2428
+ export type SmartGatewayClientConfig = {
2429
+ baseUrl: string;
2430
+ apiKey?: string;
2431
+ authToken?: string;
2432
+ timeout?: number;
2433
+ allowInsecure?: boolean;
2307
2434
  };
2435
+ declare class SmartGatewayClient {
2436
+ private readonly http;
2437
+ readonly routing: RoutingClient;
2438
+ readonly domains: DomainsClient;
2439
+ readonly dns: DnsClient;
2440
+ constructor(config: SmartGatewayClientConfig);
2441
+ getHealth(): Promise<GatewayHealthResponse>;
2442
+ getStatus(): Promise<GatewayStatusResponse>;
2443
+ getReadiness(): Promise<GatewayReadinessResponse>;
2444
+ getLiveness(): Promise<GatewayLivenessResponse>;
2445
+ getMetrics(refresh?: boolean): Promise<GatewayMetricsResponse>;
2446
+ getMetricsSummary(): Promise<GatewayMetricsSummaryResponse>;
2447
+ }
2308
2448
  export type StateRootResponse = {
2309
2449
  appId: string;
2310
2450
  stateRoot: string;
@@ -2430,143 +2570,6 @@ declare class MessagingClient {
2430
2570
  getPresence(channel: string): Promise<BaasPresenceInfo>;
2431
2571
  getStats(): Promise<any>;
2432
2572
  }
2433
- declare class DeploymentClient {
2434
- private readonly http;
2435
- constructor(http: HttpClient);
2436
- init(request: BaasInitRequest): Promise<BaasInitResponse>;
2437
- uploadFrontend(appId: string, bundle: Blob | Buffer, filename?: string): Promise<BaasUploadFrontendResponse>;
2438
- deploy(appId: string, request: BaasDeployRequest): Promise<BaasDeployResponse>;
2439
- rollback(appId: string, request: BaasRollbackRequest): Promise<BaasDeployResponse>;
2440
- status(appId: string): Promise<BaasRuntimeStatus>;
2441
- list(): Promise<BaasAppListResponse>;
2442
- get(appId: string): Promise<DeployedAppInfo>;
2443
- update(appId: string, updates: Partial<BaasDeployRequest>): Promise<DeployedAppInfo>;
2444
- delete(appId: string): Promise<{
2445
- success: boolean;
2446
- }>;
2447
- suspend(appId: string): Promise<{
2448
- success: boolean;
2449
- status: string;
2450
- }>;
2451
- resume(appId: string): Promise<{
2452
- success: boolean;
2453
- status: string;
2454
- }>;
2455
- getStats(): Promise<{
2456
- totalApps: number;
2457
- activeApps: number;
2458
- totalOwners: number;
2459
- }>;
2460
- }
2461
- export type AgentStatus = "active" | "paused" | "revoked" | "pending";
2462
- export type AgentRegisterRequest = {
2463
- name: string;
2464
- description?: string;
2465
- capabilities: string[];
2466
- rules: AgentRules;
2467
- fundingConfig?: {
2468
- chain: string;
2469
- maxAmount: string;
2470
- autoFund: boolean;
2471
- };
2472
- };
2473
- export type AgentRules = {
2474
- maxTradeAmount?: string;
2475
- allowedPairs?: string[];
2476
- allowedChains?: string[];
2477
- dailyLimit?: string;
2478
- requireApprovalAbove?: string;
2479
- customRules?: Record<string, unknown>;
2480
- };
2481
- export type AgentInfo = {
2482
- agentId: string;
2483
- name: string;
2484
- description?: string;
2485
- status: AgentStatus;
2486
- capabilities: string[];
2487
- rules: AgentRules;
2488
- owner: string;
2489
- createdAt: string;
2490
- lastActiveAt?: string;
2491
- };
2492
- export type AgentEvent = {
2493
- eventId: string;
2494
- agentId: string;
2495
- type: string;
2496
- data: Record<string, unknown>;
2497
- timestamp: string;
2498
- };
2499
- export type AgentBalance = {
2500
- chain: string;
2501
- accountId: string;
2502
- balance: string;
2503
- symbol: string;
2504
- };
2505
- export type AgentFundRequest = {
2506
- chain: string;
2507
- amount: string;
2508
- source?: string;
2509
- };
2510
- export type AgentTradeRequest = {
2511
- chain: string;
2512
- pair: string;
2513
- side: "buy" | "sell";
2514
- amount: string;
2515
- price?: string;
2516
- };
2517
- export type AgentWithdrawRequest = {
2518
- chain: string;
2519
- amount: string;
2520
- destination: string;
2521
- };
2522
- declare class AgentsClient {
2523
- private readonly http;
2524
- constructor(http: HttpClient);
2525
- register(request: AgentRegisterRequest): Promise<AgentInfo>;
2526
- get(agentId: string): Promise<AgentInfo>;
2527
- list(): Promise<{
2528
- agents: AgentInfo[];
2529
- total: number;
2530
- }>;
2531
- fund(agentId: string, request: AgentFundRequest): Promise<{
2532
- success: boolean;
2533
- txId?: string;
2534
- }>;
2535
- trade(agentId: string, request: AgentTradeRequest): Promise<{
2536
- success: boolean;
2537
- txId?: string;
2538
- }>;
2539
- withdraw(agentId: string, request: AgentWithdrawRequest): Promise<{
2540
- success: boolean;
2541
- txId?: string;
2542
- }>;
2543
- pause(agentId: string): Promise<{
2544
- success: boolean;
2545
- status: string;
2546
- }>;
2547
- resume(agentId: string): Promise<{
2548
- success: boolean;
2549
- status: string;
2550
- }>;
2551
- revoke(agentId: string): Promise<{
2552
- success: boolean;
2553
- status: string;
2554
- }>;
2555
- updateRules(agentId: string, rules: Partial<AgentRules>): Promise<AgentInfo>;
2556
- getEvents(agentId: string): Promise<{
2557
- events: AgentEvent[];
2558
- total: number;
2559
- }>;
2560
- getBalances(agentId: string): Promise<{
2561
- balances: AgentBalance[];
2562
- }>;
2563
- approve(agentId: string, operationId: string): Promise<{
2564
- success: boolean;
2565
- }>;
2566
- reject(agentId: string, operationId: string): Promise<{
2567
- success: boolean;
2568
- }>;
2569
- }
2570
2573
  export type CustomerSessionChallenge = {
2571
2574
  challenge: string;
2572
2575
  };