@hsuite/smart-engines-sdk 3.13.1 → 4.0.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/CHANGELOG.md +35 -0
- package/README.md +10 -7
- package/dist/index.d.ts +129 -35
- package/dist/index.js +256 -110
- package/dist/index.js.map +1 -1
- package/dist/nestjs/index.d.ts +118 -47
- package/dist/nestjs/index.js +241 -113
- package/dist/nestjs/index.js.map +1 -1
- package/package.json +1 -1
package/dist/nestjs/index.d.ts
CHANGED
|
@@ -1619,21 +1619,9 @@ export interface ValidatorInfo {
|
|
|
1619
1619
|
registeredAt: string;
|
|
1620
1620
|
messageType?: "validator.join" | "validator.leave" | "validator.update";
|
|
1621
1621
|
}
|
|
1622
|
-
export interface ClusterEndpointsView {
|
|
1623
|
-
clusterId: string;
|
|
1624
|
-
gatewayUrl: string;
|
|
1625
|
-
harborUrl?: string;
|
|
1626
|
-
natsUrl?: string;
|
|
1627
|
-
publicIp?: string;
|
|
1628
|
-
region?: string;
|
|
1629
|
-
}
|
|
1630
|
-
export interface ClusterInfo {
|
|
1631
|
-
clusterId: string;
|
|
1632
|
-
endpoints: ClusterEndpointsView;
|
|
1633
|
-
nodeIds: string[];
|
|
1634
|
-
}
|
|
1635
1622
|
export type HttpCallOptions = {
|
|
1636
1623
|
customerToken?: string;
|
|
1624
|
+
onBehalfOf?: string;
|
|
1637
1625
|
headers?: Record<string, string>;
|
|
1638
1626
|
};
|
|
1639
1627
|
export type HttpClient = {
|
|
@@ -1644,6 +1632,11 @@ export type HttpClient = {
|
|
|
1644
1632
|
delete<T = any>(path: string, opts?: HttpCallOptions): Promise<T>;
|
|
1645
1633
|
getText(path: string, opts?: HttpCallOptions): Promise<string>;
|
|
1646
1634
|
getBinary(path: string, opts?: HttpCallOptions): Promise<Uint8Array>;
|
|
1635
|
+
getBinaryWithMeta(path: string, opts?: HttpCallOptions): Promise<{
|
|
1636
|
+
bytes: Uint8Array;
|
|
1637
|
+
contentType?: string;
|
|
1638
|
+
filename?: string;
|
|
1639
|
+
}>;
|
|
1647
1640
|
upload<T = any>(path: string, file: Blob | Buffer, filename: string, metadata?: Record<string, string>, fieldName?: string, opts?: HttpCallOptions): Promise<T>;
|
|
1648
1641
|
setAuthToken(token: string | undefined): void;
|
|
1649
1642
|
getAuthToken(): string | undefined;
|
|
@@ -3371,6 +3364,29 @@ export type AgentInfo = {
|
|
|
3371
3364
|
owner: string;
|
|
3372
3365
|
createdAt: string;
|
|
3373
3366
|
lastActiveAt?: string;
|
|
3367
|
+
agentWallet?: string;
|
|
3368
|
+
treasuryAccount?: string;
|
|
3369
|
+
entityId?: string;
|
|
3370
|
+
};
|
|
3371
|
+
export type AgentCertification = {
|
|
3372
|
+
agentId: string;
|
|
3373
|
+
entityId?: string;
|
|
3374
|
+
ownerWallet?: string;
|
|
3375
|
+
status?: string;
|
|
3376
|
+
agentWallet?: string;
|
|
3377
|
+
treasuryAccount?: string;
|
|
3378
|
+
primaryChain?: string;
|
|
3379
|
+
rulesHash?: string;
|
|
3380
|
+
ruleRef?: string;
|
|
3381
|
+
blsGroupPublicKey?: string;
|
|
3382
|
+
stateHistoryTopicId?: string;
|
|
3383
|
+
recentEvents: Array<{
|
|
3384
|
+
agentId: string;
|
|
3385
|
+
type: string;
|
|
3386
|
+
payload: Record<string, unknown>;
|
|
3387
|
+
timestamp: string;
|
|
3388
|
+
}>;
|
|
3389
|
+
recentTxIds: string[];
|
|
3374
3390
|
};
|
|
3375
3391
|
export type AgentEvent = {
|
|
3376
3392
|
eventId: string;
|
|
@@ -3423,6 +3439,14 @@ export type AgentExecuteResponse = {
|
|
|
3423
3439
|
export type AgentPreparedTransactionResponse = PreparedTransactionResponse & {
|
|
3424
3440
|
success: true;
|
|
3425
3441
|
};
|
|
3442
|
+
export type AgentPendingApprovalResponse = {
|
|
3443
|
+
success: true;
|
|
3444
|
+
pendingOpId: string;
|
|
3445
|
+
agentId: string;
|
|
3446
|
+
action: string;
|
|
3447
|
+
status: "awaiting_approval";
|
|
3448
|
+
description: string;
|
|
3449
|
+
};
|
|
3426
3450
|
declare class AgentsClient {
|
|
3427
3451
|
private readonly http;
|
|
3428
3452
|
constructor(http: HttpClient);
|
|
@@ -3432,7 +3456,7 @@ declare class AgentsClient {
|
|
|
3432
3456
|
agents: AgentInfo[];
|
|
3433
3457
|
total: number;
|
|
3434
3458
|
}>;
|
|
3435
|
-
fund(agentId: string, request: AgentFundRequest, opts?: HttpCallOptions): Promise<AgentPreparedTransactionResponse>;
|
|
3459
|
+
fund(agentId: string, request: AgentFundRequest, opts?: HttpCallOptions): Promise<AgentPreparedTransactionResponse | AgentPendingApprovalResponse>;
|
|
3436
3460
|
trade(agentId: string, request: AgentTradeRequest, opts?: HttpCallOptions): Promise<AgentPreparedTransactionResponse>;
|
|
3437
3461
|
withdraw(agentId: string, request: AgentWithdrawRequest, opts?: HttpCallOptions): Promise<AgentPreparedTransactionResponse>;
|
|
3438
3462
|
execute(agentId: string, request: AgentExecuteRequest, opts?: HttpCallOptions): Promise<AgentExecuteResponse & {
|
|
@@ -3450,6 +3474,7 @@ declare class AgentsClient {
|
|
|
3450
3474
|
success: boolean;
|
|
3451
3475
|
status: string;
|
|
3452
3476
|
}>;
|
|
3477
|
+
certification(agentId: string, opts?: HttpCallOptions): Promise<AgentCertification>;
|
|
3453
3478
|
updateRules(agentId: string, rules: Partial<AgentRules>, opts?: HttpCallOptions): Promise<AgentInfo>;
|
|
3454
3479
|
getEvents(agentId: string, opts?: HttpCallOptions): Promise<{
|
|
3455
3480
|
events: AgentEvent[];
|
|
@@ -3668,6 +3693,11 @@ export type BaasFunctionInfo = {
|
|
|
3668
3693
|
lastInvokedAt?: string;
|
|
3669
3694
|
invocationCount: number;
|
|
3670
3695
|
};
|
|
3696
|
+
export type BaasFunctionCode = {
|
|
3697
|
+
functionId: string;
|
|
3698
|
+
code: string | null;
|
|
3699
|
+
codeHash?: string;
|
|
3700
|
+
};
|
|
3671
3701
|
export type BaasFunctionLog = {
|
|
3672
3702
|
timestamp: string;
|
|
3673
3703
|
level: "debug" | "info" | "warn" | "error";
|
|
@@ -4125,7 +4155,7 @@ declare class OperatorClient {
|
|
|
4125
4155
|
getTopup(chain: OperatorChain, accountId: string): Promise<OperatorTopUpResponse>;
|
|
4126
4156
|
}
|
|
4127
4157
|
export interface SmartEngineClientConfig {
|
|
4128
|
-
|
|
4158
|
+
validatorBaseUrl: string;
|
|
4129
4159
|
apiKey?: string;
|
|
4130
4160
|
authToken?: string;
|
|
4131
4161
|
timeout?: number;
|
|
@@ -4145,35 +4175,6 @@ export interface NetworkConnectionConfig {
|
|
|
4145
4175
|
mirrorNodeUrl?: string;
|
|
4146
4176
|
allowInsecure?: boolean;
|
|
4147
4177
|
}
|
|
4148
|
-
export interface ClusterConnectionAuth {
|
|
4149
|
-
chain: AuthChain;
|
|
4150
|
-
address: string;
|
|
4151
|
-
publicKey: string;
|
|
4152
|
-
signFn: (challenge: string) => string | Promise<string>;
|
|
4153
|
-
metadata?: {
|
|
4154
|
-
appId?: string;
|
|
4155
|
-
appName?: string;
|
|
4156
|
-
};
|
|
4157
|
-
trustAnchor?: {
|
|
4158
|
-
network: "mainnet" | "testnet" | "previewnet";
|
|
4159
|
-
registryTopicId: string;
|
|
4160
|
-
mirrorNodeUrl?: string;
|
|
4161
|
-
};
|
|
4162
|
-
allowInsecure?: boolean;
|
|
4163
|
-
}
|
|
4164
|
-
export type ClusterConnectionSeed = {
|
|
4165
|
-
bootstrap: string[];
|
|
4166
|
-
network?: never;
|
|
4167
|
-
} | {
|
|
4168
|
-
bootstrap?: never;
|
|
4169
|
-
network: NetworkName;
|
|
4170
|
-
};
|
|
4171
|
-
export type ClusterConnectionConfig = ClusterConnectionSeed & ClusterConnectionAuth;
|
|
4172
|
-
export interface ClusterConnectionResult {
|
|
4173
|
-
client: SmartEngineClient;
|
|
4174
|
-
cluster: ClusterInfo;
|
|
4175
|
-
session: AuthenticateResponse;
|
|
4176
|
-
}
|
|
4177
4178
|
export interface NetworkConnectionResult {
|
|
4178
4179
|
client: SmartEngineClient;
|
|
4179
4180
|
validator: ValidatorInfo;
|
|
@@ -4211,7 +4212,6 @@ declare class SmartEngineClient {
|
|
|
4211
4212
|
constructor(config: SmartEngineClientConfig);
|
|
4212
4213
|
static fromEnv(env: Record<string, string | undefined>): SmartEngineClient;
|
|
4213
4214
|
static connectToNetwork(config: NetworkConnectionConfig): Promise<NetworkConnectionResult>;
|
|
4214
|
-
static connectToCluster(config: ClusterConnectionConfig): Promise<ClusterConnectionResult>;
|
|
4215
4215
|
getBaseUrl(): string;
|
|
4216
4216
|
isAuthenticated(): boolean;
|
|
4217
4217
|
getHttpHealth(): {
|
|
@@ -4840,6 +4840,11 @@ declare class StorageClient {
|
|
|
4840
4840
|
constructor(http: HttpClient, getAppId: () => string);
|
|
4841
4841
|
upload(file: Blob | Buffer, filename: string, metadata?: Record<string, string>, opts?: HttpCallOptions): Promise<BaasUploadResult>;
|
|
4842
4842
|
download(cid: string, opts?: HttpCallOptions): Promise<Uint8Array>;
|
|
4843
|
+
downloadWithMeta(cid: string, opts?: HttpCallOptions): Promise<{
|
|
4844
|
+
bytes: Uint8Array;
|
|
4845
|
+
contentType?: string;
|
|
4846
|
+
filename?: string;
|
|
4847
|
+
}>;
|
|
4843
4848
|
getMetadata(cid: string, opts?: HttpCallOptions): Promise<BaasFileMetadata>;
|
|
4844
4849
|
delete(cid: string, opts?: HttpCallOptions): Promise<{
|
|
4845
4850
|
success: boolean;
|
|
@@ -4870,6 +4875,7 @@ declare class FunctionsClient {
|
|
|
4870
4875
|
total: number;
|
|
4871
4876
|
}>;
|
|
4872
4877
|
get(functionId: string, opts?: HttpCallOptions): Promise<BaasFunctionInfo>;
|
|
4878
|
+
getCode(functionId: string, opts?: HttpCallOptions): Promise<BaasFunctionCode>;
|
|
4873
4879
|
update(functionId: string, updates: Partial<BaasFunctionDeployRequest>, opts?: HttpCallOptions): Promise<BaasFunctionInfo>;
|
|
4874
4880
|
delete(functionId: string, opts?: HttpCallOptions): Promise<{
|
|
4875
4881
|
success: boolean;
|
|
@@ -12375,6 +12381,9 @@ export type CreateAgentRequest = {
|
|
|
12375
12381
|
ruleRef: RuleRef;
|
|
12376
12382
|
name: string;
|
|
12377
12383
|
agentType?: string;
|
|
12384
|
+
securityMode?: EntitySecurityMode;
|
|
12385
|
+
payerAccountId?: string;
|
|
12386
|
+
fundWith?: FundWith;
|
|
12378
12387
|
};
|
|
12379
12388
|
export type EntityCreationResult = {
|
|
12380
12389
|
entityId: string;
|
|
@@ -12425,6 +12434,56 @@ export type LaunchpadEntityResult = {
|
|
|
12425
12434
|
tokenId: string;
|
|
12426
12435
|
chainAccounts: Record<string, string>;
|
|
12427
12436
|
};
|
|
12437
|
+
export type TransferEntityRequest = {
|
|
12438
|
+
chain: ChainType;
|
|
12439
|
+
to: string;
|
|
12440
|
+
amount: string;
|
|
12441
|
+
tokenId?: string;
|
|
12442
|
+
memo?: string;
|
|
12443
|
+
};
|
|
12444
|
+
export type WithdrawEntityRequest = {
|
|
12445
|
+
chain: ChainType;
|
|
12446
|
+
destination: string;
|
|
12447
|
+
amount: string;
|
|
12448
|
+
tokenId?: string;
|
|
12449
|
+
memo?: string;
|
|
12450
|
+
};
|
|
12451
|
+
export type MintEntityRequest = {
|
|
12452
|
+
chain: ChainType;
|
|
12453
|
+
tokenId: string;
|
|
12454
|
+
amount: string;
|
|
12455
|
+
memo?: string;
|
|
12456
|
+
};
|
|
12457
|
+
export type BurnEntityRequest = {
|
|
12458
|
+
chain: ChainType;
|
|
12459
|
+
tokenId: string;
|
|
12460
|
+
amount: string;
|
|
12461
|
+
memo?: string;
|
|
12462
|
+
};
|
|
12463
|
+
export type ComplianceAction = "pause" | "restrict" | "wipe";
|
|
12464
|
+
export type ComplianceEntityRequest = {
|
|
12465
|
+
action: ComplianceAction;
|
|
12466
|
+
chain: ChainType;
|
|
12467
|
+
tokenId: string;
|
|
12468
|
+
account?: string;
|
|
12469
|
+
amount?: string;
|
|
12470
|
+
memo?: string;
|
|
12471
|
+
};
|
|
12472
|
+
export type TrustlineEntityRequest = {
|
|
12473
|
+
chain: ChainType;
|
|
12474
|
+
currency: string;
|
|
12475
|
+
issuerAddress: string;
|
|
12476
|
+
limit?: string;
|
|
12477
|
+
};
|
|
12478
|
+
export type PreparedEntityTransactionResult = {
|
|
12479
|
+
chain: string;
|
|
12480
|
+
transactionId: string;
|
|
12481
|
+
transactionBytes: string;
|
|
12482
|
+
transactionType?: string;
|
|
12483
|
+
payerAccountId?: string;
|
|
12484
|
+
expiresAt?: string;
|
|
12485
|
+
metadata?: Record<string, unknown>;
|
|
12486
|
+
};
|
|
12428
12487
|
export declare class EntitiesClient {
|
|
12429
12488
|
private readonly http;
|
|
12430
12489
|
constructor(http: HttpClient);
|
|
@@ -12458,9 +12517,23 @@ export declare class EntitiesClient {
|
|
|
12458
12517
|
}): Promise<EntityCreationResult>;
|
|
12459
12518
|
createTopic(req: CreateTopicRequest): Promise<EntityCreationResult>;
|
|
12460
12519
|
createAgent(req: CreateAgentRequest): Promise<EntityCreationResult>;
|
|
12520
|
+
prepareCreateAgent(req: Omit<CreateAgentRequest, "fundWith">): Promise<PreparedEntityCreation>;
|
|
12521
|
+
executeCreateAgent(req: {
|
|
12522
|
+
entityId: string;
|
|
12523
|
+
chain: ChainType;
|
|
12524
|
+
securityMode?: EntitySecurityMode;
|
|
12525
|
+
signedFundingBlob?: string;
|
|
12526
|
+
createTxId?: string;
|
|
12527
|
+
}): Promise<EntityCreationResult>;
|
|
12461
12528
|
launchpad(req: LaunchpadEntityRequest): Promise<LaunchpadEntityResult>;
|
|
12462
12529
|
get(entityId: string): Promise<EntityInfo>;
|
|
12463
12530
|
listByOwner(filter?: ListEntitiesFilter): Promise<ListEntitiesResponse>;
|
|
12531
|
+
transfer(entityId: string, body: TransferEntityRequest, opts?: HttpCallOptions): Promise<PreparedEntityTransactionResult>;
|
|
12532
|
+
withdraw(entityId: string, body: WithdrawEntityRequest, opts?: HttpCallOptions): Promise<PreparedEntityTransactionResult>;
|
|
12533
|
+
mint(entityId: string, body: MintEntityRequest, opts?: HttpCallOptions): Promise<PreparedEntityTransactionResult>;
|
|
12534
|
+
burn(entityId: string, body: BurnEntityRequest, opts?: HttpCallOptions): Promise<PreparedEntityTransactionResult>;
|
|
12535
|
+
compliance(entityId: string, body: ComplianceEntityRequest, opts?: HttpCallOptions): Promise<PreparedEntityTransactionResult>;
|
|
12536
|
+
trustline(entityId: string, body: TrustlineEntityRequest, opts?: HttpCallOptions): Promise<PreparedEntityTransactionResult>;
|
|
12464
12537
|
}
|
|
12465
12538
|
export type AuthenticateOptions = {
|
|
12466
12539
|
chain: BaasSupportedChain;
|
|
@@ -12494,7 +12567,6 @@ declare class BaasClient {
|
|
|
12494
12567
|
private readonly timeout;
|
|
12495
12568
|
private readonly allowInsecure;
|
|
12496
12569
|
private readonly http;
|
|
12497
|
-
private readonly txHttp;
|
|
12498
12570
|
private lastHttpError?;
|
|
12499
12571
|
private authContext?;
|
|
12500
12572
|
readonly db: DatabaseClient;
|
|
@@ -12506,7 +12578,6 @@ declare class BaasClient {
|
|
|
12506
12578
|
readonly customerSession: CustomerSessionClient;
|
|
12507
12579
|
readonly rules: RulesClient;
|
|
12508
12580
|
readonly entities: EntitiesClient;
|
|
12509
|
-
readonly transactions: TransactionsClient;
|
|
12510
12581
|
constructor(config: BaasClientConfig);
|
|
12511
12582
|
static connectToCluster(config: BaasConnectToClusterConfig): Promise<BaasClient>;
|
|
12512
12583
|
setAppId(appId: string): void;
|