@hsuite/smart-engines-sdk 3.10.0 → 3.12.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.
@@ -1632,14 +1632,19 @@ export interface ClusterInfo {
1632
1632
  endpoints: ClusterEndpointsView;
1633
1633
  nodeIds: string[];
1634
1634
  }
1635
+ export type HttpCallOptions = {
1636
+ customerToken?: string;
1637
+ headers?: Record<string, string>;
1638
+ };
1635
1639
  export type HttpClient = {
1636
- post<T = any>(path: string, body: unknown): Promise<T>;
1637
- get<T = any>(path: string): Promise<T>;
1638
- put<T = any>(path: string, body: unknown): Promise<T>;
1639
- patch<T = any>(path: string, body: unknown): Promise<T>;
1640
- delete<T = any>(path: string): Promise<T>;
1641
- getText(path: string): Promise<string>;
1642
- upload<T = any>(path: string, file: Blob | Buffer, filename: string, metadata?: Record<string, string>, fieldName?: string): Promise<T>;
1640
+ post<T = any>(path: string, body: unknown, opts?: HttpCallOptions): Promise<T>;
1641
+ get<T = any>(path: string, opts?: HttpCallOptions): Promise<T>;
1642
+ put<T = any>(path: string, body: unknown, opts?: HttpCallOptions): Promise<T>;
1643
+ patch<T = any>(path: string, body: unknown, opts?: HttpCallOptions): Promise<T>;
1644
+ delete<T = any>(path: string, opts?: HttpCallOptions): Promise<T>;
1645
+ getText(path: string, opts?: HttpCallOptions): Promise<string>;
1646
+ getBinary(path: string, opts?: HttpCallOptions): Promise<Uint8Array>;
1647
+ upload<T = any>(path: string, file: Blob | Buffer, filename: string, metadata?: Record<string, string>, fieldName?: string, opts?: HttpCallOptions): Promise<T>;
1643
1648
  setAuthToken(token: string | undefined): void;
1644
1649
  getAuthToken(): string | undefined;
1645
1650
  };
@@ -3397,45 +3402,66 @@ export type AgentWithdrawRequest = {
3397
3402
  amount: string;
3398
3403
  destination: string;
3399
3404
  };
3405
+ export type AgentExecuteRequest = {
3406
+ capability: string;
3407
+ chain?: string;
3408
+ params: Record<string, unknown>;
3409
+ };
3410
+ export type AgentExecuteStepResult = {
3411
+ kind: "onchain" | "offchain";
3412
+ status: string;
3413
+ transactionBytes?: string;
3414
+ ref?: string;
3415
+ detail?: Record<string, unknown>;
3416
+ };
3417
+ export type AgentExecuteResponse = {
3418
+ capability: string;
3419
+ steps: AgentExecuteStepResult[];
3420
+ awaitingApproval?: boolean;
3421
+ pendingOpId?: string;
3422
+ };
3400
3423
  export type AgentPreparedTransactionResponse = PreparedTransactionResponse & {
3401
3424
  success: true;
3402
3425
  };
3403
3426
  declare class AgentsClient {
3404
3427
  private readonly http;
3405
3428
  constructor(http: HttpClient);
3406
- register(request: AgentRegisterRequest): Promise<AgentInfo>;
3407
- get(agentId: string): Promise<AgentInfo>;
3408
- list(): Promise<{
3429
+ register(request: AgentRegisterRequest, opts?: HttpCallOptions): Promise<AgentInfo>;
3430
+ get(agentId: string, opts?: HttpCallOptions): Promise<AgentInfo>;
3431
+ list(opts?: HttpCallOptions): Promise<{
3409
3432
  agents: AgentInfo[];
3410
3433
  total: number;
3411
3434
  }>;
3412
- fund(agentId: string, request: AgentFundRequest): Promise<AgentPreparedTransactionResponse>;
3413
- trade(agentId: string, request: AgentTradeRequest): Promise<AgentPreparedTransactionResponse>;
3414
- withdraw(agentId: string, request: AgentWithdrawRequest): Promise<AgentPreparedTransactionResponse>;
3415
- pause(agentId: string): Promise<{
3435
+ fund(agentId: string, request: AgentFundRequest, opts?: HttpCallOptions): Promise<AgentPreparedTransactionResponse>;
3436
+ trade(agentId: string, request: AgentTradeRequest, opts?: HttpCallOptions): Promise<AgentPreparedTransactionResponse>;
3437
+ withdraw(agentId: string, request: AgentWithdrawRequest, opts?: HttpCallOptions): Promise<AgentPreparedTransactionResponse>;
3438
+ execute(agentId: string, request: AgentExecuteRequest, opts?: HttpCallOptions): Promise<AgentExecuteResponse & {
3439
+ success: true;
3440
+ }>;
3441
+ pause(agentId: string, opts?: HttpCallOptions): Promise<{
3416
3442
  success: boolean;
3417
3443
  status: string;
3418
3444
  }>;
3419
- resume(agentId: string): Promise<{
3445
+ resume(agentId: string, opts?: HttpCallOptions): Promise<{
3420
3446
  success: boolean;
3421
3447
  status: string;
3422
3448
  }>;
3423
- revoke(agentId: string): Promise<{
3449
+ revoke(agentId: string, opts?: HttpCallOptions): Promise<{
3424
3450
  success: boolean;
3425
3451
  status: string;
3426
3452
  }>;
3427
- updateRules(agentId: string, rules: Partial<AgentRules>): Promise<AgentInfo>;
3428
- getEvents(agentId: string): Promise<{
3453
+ updateRules(agentId: string, rules: Partial<AgentRules>, opts?: HttpCallOptions): Promise<AgentInfo>;
3454
+ getEvents(agentId: string, opts?: HttpCallOptions): Promise<{
3429
3455
  events: AgentEvent[];
3430
3456
  total: number;
3431
3457
  }>;
3432
- getBalances(agentId: string): Promise<{
3458
+ getBalances(agentId: string, opts?: HttpCallOptions): Promise<{
3433
3459
  balances: AgentBalance[];
3434
3460
  }>;
3435
- approve(agentId: string, operationId: string): Promise<{
3461
+ approve(agentId: string, operationId: string, opts?: HttpCallOptions): Promise<{
3436
3462
  success: boolean;
3437
3463
  }>;
3438
- reject(agentId: string, operationId: string): Promise<{
3464
+ reject(agentId: string, operationId: string, opts?: HttpCallOptions): Promise<{
3439
3465
  success: boolean;
3440
3466
  }>;
3441
3467
  }
@@ -3584,6 +3610,13 @@ export type BaasFunctionResources = {
3584
3610
  timeout: number;
3585
3611
  maxConcurrency?: number;
3586
3612
  };
3613
+ export type BaasSignedCode = {
3614
+ code: string;
3615
+ signature: string;
3616
+ publicKey: string;
3617
+ timestamp: string;
3618
+ hash: string;
3619
+ };
3587
3620
  export type BaasFunctionDeployRequest = {
3588
3621
  name: string;
3589
3622
  description?: string;
@@ -3597,6 +3630,15 @@ export type BaasFunctionDeployRequest = {
3597
3630
  }>;
3598
3631
  resources?: Partial<BaasFunctionResources>;
3599
3632
  environment?: Record<string, string>;
3633
+ signedCode?: BaasSignedCode;
3634
+ };
3635
+ export type BaasFunctionEvalRequest = {
3636
+ name?: string;
3637
+ code: string;
3638
+ runtime?: BaasFunctionRuntime;
3639
+ resources?: Partial<BaasFunctionResources>;
3640
+ input?: Record<string, unknown>;
3641
+ signedCode?: BaasSignedCode;
3600
3642
  };
3601
3643
  export type BaasFunctionDeployResult = {
3602
3644
  functionId: string;
@@ -4796,21 +4838,21 @@ declare class StorageClient {
4796
4838
  private readonly http;
4797
4839
  private readonly getAppId;
4798
4840
  constructor(http: HttpClient, getAppId: () => string);
4799
- upload(file: Blob | Buffer, filename: string, metadata?: Record<string, string>): Promise<BaasUploadResult>;
4800
- download(cid: string): Promise<any>;
4801
- getMetadata(cid: string): Promise<BaasFileMetadata>;
4802
- delete(cid: string): Promise<{
4841
+ upload(file: Blob | Buffer, filename: string, metadata?: Record<string, string>, opts?: HttpCallOptions): Promise<BaasUploadResult>;
4842
+ download(cid: string, opts?: HttpCallOptions): Promise<Uint8Array>;
4843
+ getMetadata(cid: string, opts?: HttpCallOptions): Promise<BaasFileMetadata>;
4844
+ delete(cid: string, opts?: HttpCallOptions): Promise<{
4803
4845
  success: boolean;
4804
4846
  }>;
4805
4847
  listFiles(pagination?: {
4806
4848
  limit?: number;
4807
4849
  offset?: number;
4808
- }): Promise<{
4850
+ }, opts?: HttpCallOptions): Promise<{
4809
4851
  files: BaasFileInfo[];
4810
4852
  total: number;
4811
4853
  }>;
4812
- getUsage(): Promise<BaasStorageUsage>;
4813
- exists(cid: string): Promise<{
4854
+ getUsage(opts?: HttpCallOptions): Promise<BaasStorageUsage>;
4855
+ exists(cid: string, opts?: HttpCallOptions): Promise<{
4814
4856
  exists: boolean;
4815
4857
  cid: string;
4816
4858
  }>;
@@ -4819,57 +4861,59 @@ declare class FunctionsClient {
4819
4861
  private readonly http;
4820
4862
  private readonly getAppId;
4821
4863
  constructor(http: HttpClient, getAppId: () => string);
4822
- deploy(request: BaasFunctionDeployRequest): Promise<BaasFunctionDeployResult>;
4823
- invoke(functionId: string, payload?: unknown): Promise<BaasFunctionResult>;
4824
- list(): Promise<{
4864
+ signCode(code: string): Promise<BaasSignedCode>;
4865
+ deploy(request: BaasFunctionDeployRequest, opts?: HttpCallOptions): Promise<BaasFunctionDeployResult>;
4866
+ invoke(functionId: string, payload?: unknown, opts?: HttpCallOptions): Promise<BaasFunctionResult>;
4867
+ eval(request: BaasFunctionEvalRequest, opts?: HttpCallOptions): Promise<BaasFunctionResult>;
4868
+ list(opts?: HttpCallOptions): Promise<{
4825
4869
  functions: BaasFunctionInfo[];
4826
4870
  total: number;
4827
4871
  }>;
4828
- get(functionId: string): Promise<BaasFunctionInfo>;
4829
- update(functionId: string, updates: Partial<BaasFunctionDeployRequest>): Promise<BaasFunctionInfo>;
4830
- delete(functionId: string): Promise<{
4872
+ get(functionId: string, opts?: HttpCallOptions): Promise<BaasFunctionInfo>;
4873
+ update(functionId: string, updates: Partial<BaasFunctionDeployRequest>, opts?: HttpCallOptions): Promise<BaasFunctionInfo>;
4874
+ delete(functionId: string, opts?: HttpCallOptions): Promise<{
4831
4875
  success: boolean;
4832
4876
  }>;
4833
- getLogs(functionId: string, options?: BaasFunctionLogOptions): Promise<{
4877
+ getLogs(functionId: string, options?: BaasFunctionLogOptions, opts?: HttpCallOptions): Promise<{
4834
4878
  logs: BaasFunctionLog[];
4835
4879
  total: number;
4836
4880
  }>;
4837
- getStats(): Promise<any>;
4881
+ getStats(opts?: HttpCallOptions): Promise<any>;
4838
4882
  }
4839
4883
  declare class MessagingClient {
4840
4884
  private readonly http;
4841
4885
  private readonly getAppId;
4842
4886
  constructor(http: HttpClient, getAppId: () => string);
4843
- createChannel(config: BaasChannelConfig): Promise<BaasChannelConfig & {
4887
+ createChannel(config: BaasChannelConfig, opts?: HttpCallOptions): Promise<BaasChannelConfig & {
4844
4888
  channelId: string;
4845
4889
  }>;
4846
- deleteChannel(channelId: string): Promise<{
4890
+ deleteChannel(channelId: string, opts?: HttpCallOptions): Promise<{
4847
4891
  success: boolean;
4848
4892
  }>;
4849
- getChannel(channelId: string): Promise<BaasChannelConfig & {
4893
+ getChannel(channelId: string, opts?: HttpCallOptions): Promise<BaasChannelConfig & {
4850
4894
  channelId: string;
4851
4895
  messageCount: number;
4852
4896
  }>;
4853
- listChannels(): Promise<{
4897
+ listChannels(opts?: HttpCallOptions): Promise<{
4854
4898
  channels: Array<BaasChannelConfig & {
4855
4899
  channelId: string;
4856
4900
  }>;
4857
4901
  total: number;
4858
4902
  }>;
4859
- publish(channel: string, message: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<BaasPublishResult>;
4860
- getHistory(channel: string, options?: BaasHistoryOptions): Promise<{
4903
+ publish(channel: string, message: Record<string, unknown>, metadata?: Record<string, unknown>, opts?: HttpCallOptions): Promise<BaasPublishResult>;
4904
+ getHistory(channel: string, options?: BaasHistoryOptions, opts?: HttpCallOptions): Promise<{
4861
4905
  messages: BaasMessage[];
4862
4906
  total: number;
4863
4907
  hasMore: boolean;
4864
4908
  }>;
4865
- setPresence(channel: string, member: BaasPresenceMember): Promise<{
4909
+ setPresence(channel: string, member: BaasPresenceMember, opts?: HttpCallOptions): Promise<{
4866
4910
  success: boolean;
4867
4911
  }>;
4868
- removePresence(channel: string, clientId: string): Promise<{
4912
+ removePresence(channel: string, clientId: string, opts?: HttpCallOptions): Promise<{
4869
4913
  success: boolean;
4870
4914
  }>;
4871
- getPresence(channel: string): Promise<BaasPresenceInfo>;
4872
- getStats(): Promise<any>;
4915
+ getPresence(channel: string, opts?: HttpCallOptions): Promise<BaasPresenceInfo>;
4916
+ getStats(opts?: HttpCallOptions): Promise<any>;
4873
4917
  }
4874
4918
  export type CustomerSessionChallenge = {
4875
4919
  challenge: string;