@hsuite/smart-engines-sdk 3.0.3 → 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.
- package/dist/index.d.ts +241 -2
- package/dist/index.js +500 -0
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.d.ts +186 -1
- package/dist/nestjs/index.js +457 -0
- package/dist/nestjs/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -970,6 +970,46 @@ export declare class MirrorNodeError extends Error {
|
|
|
970
970
|
statusCode: number;
|
|
971
971
|
constructor(message: string, statusCode: number);
|
|
972
972
|
}
|
|
973
|
+
export interface ClusterEndpointsView {
|
|
974
|
+
clusterId: string;
|
|
975
|
+
gatewayUrl: string;
|
|
976
|
+
harborUrl?: string;
|
|
977
|
+
natsUrl?: string;
|
|
978
|
+
publicIp?: string;
|
|
979
|
+
region?: string;
|
|
980
|
+
}
|
|
981
|
+
export interface ClusterInfo {
|
|
982
|
+
clusterId: string;
|
|
983
|
+
endpoints: ClusterEndpointsView;
|
|
984
|
+
nodeIds: string[];
|
|
985
|
+
}
|
|
986
|
+
export interface ClusterDiscoveryConfig {
|
|
987
|
+
bootstrap: string[];
|
|
988
|
+
cacheTtlMs?: number;
|
|
989
|
+
fetchTimeoutMs?: number;
|
|
990
|
+
trustAnchor?: ValidatorDiscoveryConfig;
|
|
991
|
+
allowInsecure?: boolean;
|
|
992
|
+
}
|
|
993
|
+
declare class ClusterDiscoveryClient {
|
|
994
|
+
private readonly bootstrap;
|
|
995
|
+
private readonly cacheTtlMs;
|
|
996
|
+
private readonly fetchTimeoutMs;
|
|
997
|
+
private readonly allowInsecure;
|
|
998
|
+
private readonly trustAnchorClient;
|
|
999
|
+
private cache;
|
|
1000
|
+
constructor(config: ClusterDiscoveryConfig);
|
|
1001
|
+
getClusters(forceRefresh?: boolean): Promise<ClusterInfo[]>;
|
|
1002
|
+
getRandomCluster(forceRefresh?: boolean): Promise<ClusterInfo | null>;
|
|
1003
|
+
getRandomGatewayUrl(forceRefresh?: boolean): Promise<string | null>;
|
|
1004
|
+
getClusterById(clusterId: string, forceRefresh?: boolean): Promise<ClusterInfo | null>;
|
|
1005
|
+
clearCache(): void;
|
|
1006
|
+
private isCacheValid;
|
|
1007
|
+
private fetchFromFirstAvailableSeed;
|
|
1008
|
+
private fetchClustersFromSeed;
|
|
1009
|
+
private normalizeClusterEntry;
|
|
1010
|
+
private verifyAgainstTrustAnchor;
|
|
1011
|
+
private pickRandomIndex;
|
|
1012
|
+
}
|
|
973
1013
|
export type AuthChain = "hedera" | "xrpl" | "polkadot" | "stellar" | "solana";
|
|
974
1014
|
export interface SecurityConfig {
|
|
975
1015
|
allowInsecure?: boolean;
|
|
@@ -1070,6 +1110,14 @@ export declare class SdkHttpError extends Error {
|
|
|
1070
1110
|
}
|
|
1071
1111
|
export declare function createHttpClient(config: HttpClientConfig): HttpClient;
|
|
1072
1112
|
export declare function encodePathParam(param: string): string;
|
|
1113
|
+
export interface RuleRejectedDetails {
|
|
1114
|
+
error: "rule_rejected";
|
|
1115
|
+
reason: string;
|
|
1116
|
+
ruleAtoms: string[];
|
|
1117
|
+
}
|
|
1118
|
+
export declare function isRuleRejected(err: unknown): err is SdkHttpError & {
|
|
1119
|
+
details: RuleRejectedDetails;
|
|
1120
|
+
};
|
|
1073
1121
|
export type SubscriptionTierName = "free_testnet" | "starter" | "professional" | "enterprise";
|
|
1074
1122
|
export type SubscriptionStatus = "pending_deposit" | "deposit_confirmed" | "active" | "expired" | "cancelled";
|
|
1075
1123
|
export type DepositWalletStatus = "pending" | "locked" | "expired" | "slashed" | "released";
|
|
@@ -1570,6 +1618,48 @@ export declare class SnapshotsClient {
|
|
|
1570
1618
|
listByToken(tokenId: string, pagination?: PaginationOptions): Promise<SnapshotListResponse>;
|
|
1571
1619
|
download(snapshotId: string, format?: SnapshotFormat): Promise<any>;
|
|
1572
1620
|
}
|
|
1621
|
+
export type HistoricalBalanceChain = "hedera" | "xrpl" | "polkadot";
|
|
1622
|
+
export type HistoricalBalanceQueryParams = {
|
|
1623
|
+
chain: HistoricalBalanceChain;
|
|
1624
|
+
entityId: string;
|
|
1625
|
+
account: string;
|
|
1626
|
+
atTimestamp: number;
|
|
1627
|
+
};
|
|
1628
|
+
export type HistoricalBalanceResult = {
|
|
1629
|
+
chain: HistoricalBalanceChain;
|
|
1630
|
+
entityId: string;
|
|
1631
|
+
account: string;
|
|
1632
|
+
atTimestamp: number;
|
|
1633
|
+
balance: string;
|
|
1634
|
+
source: "archive";
|
|
1635
|
+
};
|
|
1636
|
+
export type HistoricalBalanceClientConfig = {
|
|
1637
|
+
baseUrl: string;
|
|
1638
|
+
authToken?: string;
|
|
1639
|
+
apiKey?: string;
|
|
1640
|
+
timeoutMs?: number;
|
|
1641
|
+
fetchImpl?: typeof fetch;
|
|
1642
|
+
};
|
|
1643
|
+
export declare class HistoricalBalanceClientError extends Error {
|
|
1644
|
+
readonly statusCode: number;
|
|
1645
|
+
readonly details?: unknown | undefined;
|
|
1646
|
+
constructor(message: string, statusCode: number, details?: unknown | undefined);
|
|
1647
|
+
}
|
|
1648
|
+
export declare class HistoricalBalanceClient {
|
|
1649
|
+
private readonly baseUrl?;
|
|
1650
|
+
private readonly authToken?;
|
|
1651
|
+
private readonly apiKey?;
|
|
1652
|
+
private readonly timeoutMs;
|
|
1653
|
+
private readonly fetchImpl?;
|
|
1654
|
+
private readonly http?;
|
|
1655
|
+
constructor(config: HistoricalBalanceClientConfig | {
|
|
1656
|
+
http: HttpClient;
|
|
1657
|
+
});
|
|
1658
|
+
static fromHttp(http: HttpClient): HistoricalBalanceClient;
|
|
1659
|
+
getBalance(params: HistoricalBalanceQueryParams): Promise<HistoricalBalanceResult>;
|
|
1660
|
+
private validateParams;
|
|
1661
|
+
private standaloneFetch;
|
|
1662
|
+
}
|
|
1573
1663
|
export type SettlementPurpose = "subscription" | "deposit" | "fee";
|
|
1574
1664
|
export type SettlementAsset = {
|
|
1575
1665
|
symbol: string;
|
|
@@ -1611,6 +1701,121 @@ export declare class SettlementClient {
|
|
|
1611
1701
|
confirmXrpLanded(settlementId: string): Promise<SettlementStatusResponse>;
|
|
1612
1702
|
getHistory(entityId: string): Promise<SettlementHistoryEntry[]>;
|
|
1613
1703
|
}
|
|
1704
|
+
export type GovernanceVotingPowerMethod = "token_balance" | "quadratic" | "one_person_one_vote" | "nft_based" | "time_weighted" | "delegated";
|
|
1705
|
+
export type GovernanceProposalStatus = "pending" | "active" | "passed" | "failed" | "executed" | "cancelled" | "expired" | "vetoed";
|
|
1706
|
+
export type GovernanceVoteType = "for" | "against" | "abstain";
|
|
1707
|
+
export interface GovernanceProposalData {
|
|
1708
|
+
proposalId: string;
|
|
1709
|
+
proposer: string;
|
|
1710
|
+
title: string;
|
|
1711
|
+
description: string;
|
|
1712
|
+
actions: unknown[];
|
|
1713
|
+
status: GovernanceProposalStatus;
|
|
1714
|
+
createdAt: string | Date;
|
|
1715
|
+
votingStartsAt: string | Date;
|
|
1716
|
+
votingEndsAt: string | Date;
|
|
1717
|
+
executionDeadline?: string | Date;
|
|
1718
|
+
votes: {
|
|
1719
|
+
for: string;
|
|
1720
|
+
against: string;
|
|
1721
|
+
abstain: string;
|
|
1722
|
+
totalVotingPower: string;
|
|
1723
|
+
};
|
|
1724
|
+
executionResult?: {
|
|
1725
|
+
success: boolean;
|
|
1726
|
+
transactionId?: string;
|
|
1727
|
+
error?: string;
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1730
|
+
export interface GovernanceConfig {
|
|
1731
|
+
governanceTokenId: string;
|
|
1732
|
+
decimals?: number;
|
|
1733
|
+
votingPowerMethod?: GovernanceVotingPowerMethod;
|
|
1734
|
+
quorumPercent?: number;
|
|
1735
|
+
approvalThresholdPercent?: number;
|
|
1736
|
+
proposalThreshold: string;
|
|
1737
|
+
votingPeriodMs: number;
|
|
1738
|
+
timeLockMs?: number;
|
|
1739
|
+
maxExecutionDelayMs?: number;
|
|
1740
|
+
votingEligibility?: Record<string, unknown>;
|
|
1741
|
+
proposalEligibility?: Record<string, unknown>;
|
|
1742
|
+
allowDelegation?: boolean;
|
|
1743
|
+
allowVoteChange?: boolean;
|
|
1744
|
+
vetoCouncil?: string[];
|
|
1745
|
+
maxActiveProposalsPerAccount?: number;
|
|
1746
|
+
proposalCooldownMs?: number;
|
|
1747
|
+
wisdomWeightFn?: {
|
|
1748
|
+
registryKey: string;
|
|
1749
|
+
};
|
|
1750
|
+
delegation?: {
|
|
1751
|
+
maxHops?: number;
|
|
1752
|
+
decayPerHop?: number;
|
|
1753
|
+
concentrationAlert?: number;
|
|
1754
|
+
};
|
|
1755
|
+
description?: string;
|
|
1756
|
+
}
|
|
1757
|
+
export interface GovernanceValidationContext {
|
|
1758
|
+
chain?: string;
|
|
1759
|
+
network?: "mainnet" | "testnet";
|
|
1760
|
+
callerAccountId: string;
|
|
1761
|
+
timestamp?: string | Date;
|
|
1762
|
+
action: "create_proposal" | "cast_vote" | "execute_proposal" | "cancel_proposal" | "veto" | "delegate";
|
|
1763
|
+
proposal?: GovernanceProposalData;
|
|
1764
|
+
voteType?: GovernanceVoteType;
|
|
1765
|
+
tokenBalance?: string;
|
|
1766
|
+
votingPower?: string;
|
|
1767
|
+
lastProposalAt?: string | Date;
|
|
1768
|
+
activeProposalCount?: number;
|
|
1769
|
+
delegation?: {
|
|
1770
|
+
delegateTo?: string;
|
|
1771
|
+
delegatedPower?: string;
|
|
1772
|
+
};
|
|
1773
|
+
daoId?: string;
|
|
1774
|
+
totalDaoVotingPower?: string;
|
|
1775
|
+
}
|
|
1776
|
+
export interface GovernanceValidationResult {
|
|
1777
|
+
isValid: boolean;
|
|
1778
|
+
reason?: string;
|
|
1779
|
+
metadata?: Record<string, unknown>;
|
|
1780
|
+
validatedAt?: string;
|
|
1781
|
+
}
|
|
1782
|
+
export interface GovernanceSimulateRequest {
|
|
1783
|
+
config: GovernanceConfig;
|
|
1784
|
+
context: GovernanceValidationContext;
|
|
1785
|
+
}
|
|
1786
|
+
export declare class GovernanceClient {
|
|
1787
|
+
private readonly http;
|
|
1788
|
+
constructor(http: HttpClient);
|
|
1789
|
+
simulate(params: GovernanceSimulateRequest): Promise<GovernanceValidationResult>;
|
|
1790
|
+
}
|
|
1791
|
+
export type PersonhoodAttestationMethod = "web-of-trust" | "biometric" | "pop-protocol";
|
|
1792
|
+
export interface PersonhoodProof {
|
|
1793
|
+
attestationMethod: PersonhoodAttestationMethod;
|
|
1794
|
+
payload: unknown;
|
|
1795
|
+
}
|
|
1796
|
+
export interface PersonhoodCert {
|
|
1797
|
+
address: string;
|
|
1798
|
+
issuerId: string;
|
|
1799
|
+
attestationMethod: PersonhoodAttestationMethod;
|
|
1800
|
+
issuedAt: number;
|
|
1801
|
+
expiresAt: number;
|
|
1802
|
+
signature: string;
|
|
1803
|
+
}
|
|
1804
|
+
export interface PersonhoodVerifyParams {
|
|
1805
|
+
candidate: string;
|
|
1806
|
+
proof: PersonhoodProof;
|
|
1807
|
+
}
|
|
1808
|
+
export declare const PERSONHOOD_VERIFIER_NOT_CONFIGURED: "personhood_verifier_not_configured";
|
|
1809
|
+
export declare class PersonhoodClient {
|
|
1810
|
+
private readonly http;
|
|
1811
|
+
constructor(http: HttpClient);
|
|
1812
|
+
verify(params: PersonhoodVerifyParams): Promise<PersonhoodCert | null>;
|
|
1813
|
+
}
|
|
1814
|
+
export declare function isPersonhoodVerifierNotConfigured(err: unknown): err is SdkHttpError & {
|
|
1815
|
+
details: {
|
|
1816
|
+
error: typeof PERSONHOOD_VERIFIER_NOT_CONFIGURED;
|
|
1817
|
+
};
|
|
1818
|
+
};
|
|
1614
1819
|
export interface SmartEngineClientConfig {
|
|
1615
1820
|
baseUrl: string;
|
|
1616
1821
|
apiKey?: string;
|
|
@@ -1633,6 +1838,28 @@ export interface NetworkConnectionConfig {
|
|
|
1633
1838
|
mirrorNodeUrl?: string;
|
|
1634
1839
|
allowInsecure?: boolean;
|
|
1635
1840
|
}
|
|
1841
|
+
export interface ClusterConnectionConfig {
|
|
1842
|
+
bootstrap: string[];
|
|
1843
|
+
chain: AuthChain;
|
|
1844
|
+
address: string;
|
|
1845
|
+
publicKey: string;
|
|
1846
|
+
signFn: (challenge: string) => string | Promise<string>;
|
|
1847
|
+
metadata?: {
|
|
1848
|
+
appId?: string;
|
|
1849
|
+
appName?: string;
|
|
1850
|
+
};
|
|
1851
|
+
trustAnchor?: {
|
|
1852
|
+
network: "mainnet" | "testnet" | "previewnet";
|
|
1853
|
+
registryTopicId: string;
|
|
1854
|
+
mirrorNodeUrl?: string;
|
|
1855
|
+
};
|
|
1856
|
+
allowInsecure?: boolean;
|
|
1857
|
+
}
|
|
1858
|
+
export interface ClusterConnectionResult {
|
|
1859
|
+
client: SmartEngineClient;
|
|
1860
|
+
cluster: ClusterInfo;
|
|
1861
|
+
session: AuthenticateResponse;
|
|
1862
|
+
}
|
|
1636
1863
|
export interface NetworkConnectionResult {
|
|
1637
1864
|
client: SmartEngineClient;
|
|
1638
1865
|
validator: ValidatorInfo;
|
|
@@ -1649,9 +1876,13 @@ export declare class SmartEngineClient {
|
|
|
1649
1876
|
readonly ipfs: IPFSClient;
|
|
1650
1877
|
readonly transactions: TransactionsClient;
|
|
1651
1878
|
readonly snapshots: SnapshotsClient;
|
|
1879
|
+
readonly historicalBalance: HistoricalBalanceClient;
|
|
1652
1880
|
readonly settlement: SettlementClient;
|
|
1881
|
+
readonly governance: GovernanceClient;
|
|
1882
|
+
readonly personhood: PersonhoodClient;
|
|
1653
1883
|
constructor(config: SmartEngineClientConfig);
|
|
1654
1884
|
static connectToNetwork(config: NetworkConnectionConfig): Promise<NetworkConnectionResult>;
|
|
1885
|
+
static connectToCluster(config: ClusterConnectionConfig): Promise<ClusterConnectionResult>;
|
|
1655
1886
|
getBaseUrl(): string;
|
|
1656
1887
|
isAuthenticated(): boolean;
|
|
1657
1888
|
getHttpHealth(): {
|
|
@@ -2096,7 +2327,7 @@ declare function xlmToStroops(xlm: string | number): string;
|
|
|
2096
2327
|
declare function validateBitcoinAddress(address: string): boolean;
|
|
2097
2328
|
declare function satoshisToBtc(satoshis: string | number): string;
|
|
2098
2329
|
declare function btcToSatoshis(btc: string | number): string;
|
|
2099
|
-
export type BaasService = "auth" | "database" | "storage" | "functions" | "messaging"
|
|
2330
|
+
export type BaasService = "auth" | "database" | "storage" | "functions" | "messaging";
|
|
2100
2331
|
export type BaasSupportedChain = "hedera" | "xrpl" | "polkadot" | "solana";
|
|
2101
2332
|
export type BaasEndpoints = {
|
|
2102
2333
|
auth: string;
|
|
@@ -2854,7 +3085,7 @@ declare namespace baas {
|
|
|
2854
3085
|
export { AgentBalance, AgentEvent, AgentFundRequest, AgentInfo, AgentOperation, AgentRegisterRequest, AgentRules, AgentRulesValidationResult, AgentStatus, AgentTradeRequest, AgentWithdrawRequest, AgentsClient, AuthenticateOptions, BaasAppListResponse, BaasAuthConfig, BaasAuthResult, BaasChallengeRequest, BaasChallengeResponse, BaasChannelConfig, BaasClient, BaasClientConfig, BaasDeleteResult, BaasDeployRequest, BaasDeployResponse, BaasDocument, BaasEndpoints, BaasError, BaasErrorDetails, BaasErrorResponse, BaasFileInfo, BaasFileMetadata, BaasFindResult, BaasFunctionDeployRequest, BaasFunctionDeployResult, BaasFunctionInfo, BaasFunctionLog, BaasFunctionLogOptions, BaasFunctionResources, BaasFunctionResult, BaasFunctionRuntime, BaasHistoryOptions, BaasInitRequest, BaasInitResponse, BaasInsertResult, BaasMerkleProof, BaasMessage, BaasPresenceInfo, BaasPresenceMember, BaasPublishResult, BaasQueryOptions, BaasRollbackRequest, BaasRuntimeStatus, BaasService, BaasSessionInfo, BaasStateTransition, BaasStorageUsage, BaasSupportedChain, BaasTriggerType, BaasUpdateResult, BaasUploadFrontendResponse, BaasUploadResult, BaasVerifyRequest, ChannelSubscription, DatabaseClient, DatabaseStatsResponse, DbComparisonOperator, DbDocument, DbQuery, DeployedApp, DeployedAppInfo, DeployedAppLimits, DeployedAppStatus, DeployedAppUsage, DeploymentClient, DocumentProofResponse, FunctionsClient, MessageHandler, MessagingClient, StateRootResponse, StateTransitionsResponse, StorageClient, validateAgentRules };
|
|
2855
3086
|
}
|
|
2856
3087
|
declare namespace discovery {
|
|
2857
|
-
export { MIRROR_NODE_URLS, MirrorNodeClient, MirrorNodeConfig, MirrorNodeError, TopicMessage, TopicMessagesResponse, ValidatorDiscoveryClient, ValidatorDiscoveryConfig, ValidatorInfo, ValidatorMetadata, ValidatorNetworkEndpoints };
|
|
3088
|
+
export { ClusterDiscoveryClient, ClusterDiscoveryConfig, ClusterEndpointsView, ClusterInfo, MIRROR_NODE_URLS, MirrorNodeClient, MirrorNodeConfig, MirrorNodeError, TopicMessage, TopicMessagesResponse, ValidatorDiscoveryClient, ValidatorDiscoveryConfig, ValidatorInfo, ValidatorMetadata, ValidatorNetworkEndpoints };
|
|
2858
3089
|
}
|
|
2859
3090
|
declare namespace auth {
|
|
2860
3091
|
export { AuthChain, AuthenticateRequest, AuthenticateResponse, ChallengeResponse, SecurityConfig, SessionInfo, ValidatorAuthClient, ValidatorAuthConfig, ValidatorAuthError };
|
|
@@ -2868,6 +3099,12 @@ declare namespace subscription {
|
|
|
2868
3099
|
declare namespace settlement {
|
|
2869
3100
|
export { SettlementAsset, SettlementClient, SettlementHistoryEntry, SettlementInitiateRequest, SettlementPurpose, SettlementStatusResponse };
|
|
2870
3101
|
}
|
|
3102
|
+
declare namespace governance {
|
|
3103
|
+
export { GovernanceClient, GovernanceConfig, GovernanceProposalData, GovernanceProposalStatus, GovernanceSimulateRequest, GovernanceValidationContext, GovernanceValidationResult, GovernanceVoteType, GovernanceVotingPowerMethod };
|
|
3104
|
+
}
|
|
3105
|
+
declare namespace personhood {
|
|
3106
|
+
export { PERSONHOOD_VERIFIER_NOT_CONFIGURED, PersonhoodAttestationMethod, PersonhoodCert, PersonhoodClient, PersonhoodProof, PersonhoodVerifyParams, isPersonhoodVerifierNotConfigured };
|
|
3107
|
+
}
|
|
2871
3108
|
|
|
2872
3109
|
export {
|
|
2873
3110
|
RetryConfig as ResilienceRetryConfig,
|
|
@@ -2876,6 +3113,8 @@ export {
|
|
|
2876
3113
|
baas,
|
|
2877
3114
|
chains,
|
|
2878
3115
|
discovery,
|
|
3116
|
+
governance,
|
|
3117
|
+
personhood,
|
|
2879
3118
|
settlement,
|
|
2880
3119
|
subscription,
|
|
2881
3120
|
};
|