@hsuite/smart-engines-sdk 3.7.0 → 3.11.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
  };
@@ -1722,7 +1727,7 @@ export interface AuthenticateResponse {
1722
1727
  expiresAt: string;
1723
1728
  message: string;
1724
1729
  }
1725
- export type SubscriptionTierName = "free_testnet" | "starter" | "professional" | "enterprise";
1730
+ export type SubscriptionTierName = "builder" | "growth" | "scale" | "enterprise";
1726
1731
  export type SubscriptionStatus = "pending_deposit" | "deposit_confirmed" | "active" | "expired" | "cancelled";
1727
1732
  export type DepositWalletStatus = "pending" | "locked" | "expired" | "slashed" | "released";
1728
1733
  export type SubscriptionTierInfo = {
@@ -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;
@@ -3697,6 +3739,7 @@ export type BaasInitResponse = {
3697
3739
  repository: string;
3698
3740
  };
3699
3741
  };
3742
+ export type BaasReissuePushCredentialsResponse = BaasInitResponse;
3700
3743
  export type BaasDeployRequest = {
3701
3744
  tag: string;
3702
3745
  port?: number;
@@ -3756,6 +3799,8 @@ declare class DeploymentClient {
3756
3799
  private readonly http;
3757
3800
  constructor(http: HttpClient);
3758
3801
  init(request: BaasInitRequest): Promise<BaasInitResponse>;
3802
+ pushCredentials(appId: string): Promise<BaasInitResponse>;
3803
+ reissuePushCredentials(appId: string): Promise<BaasReissuePushCredentialsResponse>;
3759
3804
  uploadFrontend(appId: string, bundle: Blob | Buffer, filename?: string): Promise<BaasUploadFrontendResponse>;
3760
3805
  deploy(appId: string, request: BaasDeployRequest): Promise<BaasDeployResponse>;
3761
3806
  rollback(appId: string, request: BaasRollbackRequest): Promise<BaasDeployResponse>;
@@ -4793,21 +4838,21 @@ declare class StorageClient {
4793
4838
  private readonly http;
4794
4839
  private readonly getAppId;
4795
4840
  constructor(http: HttpClient, getAppId: () => string);
4796
- upload(file: Blob | Buffer, filename: string, metadata?: Record<string, string>): Promise<BaasUploadResult>;
4797
- download(cid: string): Promise<any>;
4798
- getMetadata(cid: string): Promise<BaasFileMetadata>;
4799
- 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<{
4800
4845
  success: boolean;
4801
4846
  }>;
4802
4847
  listFiles(pagination?: {
4803
4848
  limit?: number;
4804
4849
  offset?: number;
4805
- }): Promise<{
4850
+ }, opts?: HttpCallOptions): Promise<{
4806
4851
  files: BaasFileInfo[];
4807
4852
  total: number;
4808
4853
  }>;
4809
- getUsage(): Promise<BaasStorageUsage>;
4810
- exists(cid: string): Promise<{
4854
+ getUsage(opts?: HttpCallOptions): Promise<BaasStorageUsage>;
4855
+ exists(cid: string, opts?: HttpCallOptions): Promise<{
4811
4856
  exists: boolean;
4812
4857
  cid: string;
4813
4858
  }>;
@@ -4816,57 +4861,59 @@ declare class FunctionsClient {
4816
4861
  private readonly http;
4817
4862
  private readonly getAppId;
4818
4863
  constructor(http: HttpClient, getAppId: () => string);
4819
- deploy(request: BaasFunctionDeployRequest): Promise<BaasFunctionDeployResult>;
4820
- invoke(functionId: string, payload?: unknown): Promise<BaasFunctionResult>;
4821
- 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<{
4822
4869
  functions: BaasFunctionInfo[];
4823
4870
  total: number;
4824
4871
  }>;
4825
- get(functionId: string): Promise<BaasFunctionInfo>;
4826
- update(functionId: string, updates: Partial<BaasFunctionDeployRequest>): Promise<BaasFunctionInfo>;
4827
- 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<{
4828
4875
  success: boolean;
4829
4876
  }>;
4830
- getLogs(functionId: string, options?: BaasFunctionLogOptions): Promise<{
4877
+ getLogs(functionId: string, options?: BaasFunctionLogOptions, opts?: HttpCallOptions): Promise<{
4831
4878
  logs: BaasFunctionLog[];
4832
4879
  total: number;
4833
4880
  }>;
4834
- getStats(): Promise<any>;
4881
+ getStats(opts?: HttpCallOptions): Promise<any>;
4835
4882
  }
4836
4883
  declare class MessagingClient {
4837
4884
  private readonly http;
4838
4885
  private readonly getAppId;
4839
4886
  constructor(http: HttpClient, getAppId: () => string);
4840
- createChannel(config: BaasChannelConfig): Promise<BaasChannelConfig & {
4887
+ createChannel(config: BaasChannelConfig, opts?: HttpCallOptions): Promise<BaasChannelConfig & {
4841
4888
  channelId: string;
4842
4889
  }>;
4843
- deleteChannel(channelId: string): Promise<{
4890
+ deleteChannel(channelId: string, opts?: HttpCallOptions): Promise<{
4844
4891
  success: boolean;
4845
4892
  }>;
4846
- getChannel(channelId: string): Promise<BaasChannelConfig & {
4893
+ getChannel(channelId: string, opts?: HttpCallOptions): Promise<BaasChannelConfig & {
4847
4894
  channelId: string;
4848
4895
  messageCount: number;
4849
4896
  }>;
4850
- listChannels(): Promise<{
4897
+ listChannels(opts?: HttpCallOptions): Promise<{
4851
4898
  channels: Array<BaasChannelConfig & {
4852
4899
  channelId: string;
4853
4900
  }>;
4854
4901
  total: number;
4855
4902
  }>;
4856
- publish(channel: string, message: Record<string, unknown>, metadata?: Record<string, unknown>): Promise<BaasPublishResult>;
4857
- 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<{
4858
4905
  messages: BaasMessage[];
4859
4906
  total: number;
4860
4907
  hasMore: boolean;
4861
4908
  }>;
4862
- setPresence(channel: string, member: BaasPresenceMember): Promise<{
4909
+ setPresence(channel: string, member: BaasPresenceMember, opts?: HttpCallOptions): Promise<{
4863
4910
  success: boolean;
4864
4911
  }>;
4865
- removePresence(channel: string, clientId: string): Promise<{
4912
+ removePresence(channel: string, clientId: string, opts?: HttpCallOptions): Promise<{
4866
4913
  success: boolean;
4867
4914
  }>;
4868
- getPresence(channel: string): Promise<BaasPresenceInfo>;
4869
- getStats(): Promise<any>;
4915
+ getPresence(channel: string, opts?: HttpCallOptions): Promise<BaasPresenceInfo>;
4916
+ getStats(opts?: HttpCallOptions): Promise<any>;
4870
4917
  }
4871
4918
  export type CustomerSessionChallenge = {
4872
4919
  challenge: string;
@@ -4893,7 +4940,7 @@ export type CustomerSessionInfo = {
4893
4940
  customerAddress: string;
4894
4941
  subscriptionContext?: {
4895
4942
  nftSerial: number;
4896
- tier: "free_testnet" | "starter" | "professional" | "enterprise";
4943
+ tier: "builder" | "growth" | "scale" | "enterprise";
4897
4944
  expiresAt: string;
4898
4945
  allowedAutomations?: string[];
4899
4946
  };
@@ -12288,17 +12335,40 @@ type CreateTokenRequest$1 = {
12288
12335
  initialSupply?: string;
12289
12336
  ruleRef: RuleRef;
12290
12337
  memo?: string;
12338
+ securityMode?: EntitySecurityMode;
12339
+ payerAccountId?: string;
12340
+ fundWith?: FundWith;
12291
12341
  };
12342
+ export type EntitySecurityMode = "partial" | "full";
12343
+ export type PreparedEntityCreation = {
12344
+ entityId: string;
12345
+ chain: ChainType;
12346
+ address: string;
12347
+ reserveRequirement: string;
12348
+ prepared: PreparedTransaction[];
12349
+ };
12350
+ export type FundWith = (prepared: PreparedTransaction[], ctx: {
12351
+ address: string;
12352
+ reserveRequirement: string;
12353
+ }) => Promise<{
12354
+ signedFundingBlob?: string;
12355
+ } | void>;
12292
12356
  type CreateAccountRequest$1 = {
12293
12357
  chain: ChainType;
12294
12358
  ruleRef: RuleRef;
12295
12359
  initialBalance?: string;
12296
12360
  publicKey?: string;
12361
+ securityMode?: EntitySecurityMode;
12362
+ payerAccountId?: string;
12363
+ fundWith?: FundWith;
12297
12364
  };
12298
12365
  export type CreateTopicRequest = {
12299
12366
  chain: ChainType;
12300
12367
  ruleRef: RuleRef;
12301
12368
  memo?: string;
12369
+ securityMode?: EntitySecurityMode;
12370
+ payerAccountId?: string;
12371
+ fundWith?: FundWith;
12302
12372
  };
12303
12373
  export type CreateAgentRequest = {
12304
12374
  primaryChain: ChainType;
@@ -12358,8 +12428,34 @@ export type LaunchpadEntityResult = {
12358
12428
  export declare class EntitiesClient {
12359
12429
  private readonly http;
12360
12430
  constructor(http: HttpClient);
12431
+ private static readonly PAYER_FUNDED_TOKEN_CHAINS;
12432
+ prepareCreateToken(req: Omit<CreateTokenRequest$1, "fundWith">): Promise<PreparedEntityCreation>;
12433
+ executeCreateToken(req: {
12434
+ entityId: string;
12435
+ chain: ChainType;
12436
+ securityMode?: EntitySecurityMode;
12437
+ createTxId?: string;
12438
+ signedFundingBlob?: string;
12439
+ }): Promise<EntityCreationResult>;
12361
12440
  createToken(req: CreateTokenRequest$1): Promise<EntityCreationResult>;
12441
+ prepareCreateAccount(req: Omit<CreateAccountRequest$1, "fundWith">): Promise<PreparedEntityCreation>;
12442
+ executeCreateAccount(req: {
12443
+ entityId: string;
12444
+ chain: ChainType;
12445
+ securityMode?: EntitySecurityMode;
12446
+ signedFundingBlob?: string;
12447
+ createTxId?: string;
12448
+ }): Promise<EntityCreationResult>;
12449
+ private static readonly PAYER_FUNDED_CREATE_CHAINS;
12450
+ private static readonly FUNDING_BLOB_RELAY_CHAINS;
12362
12451
  createAccount(req: CreateAccountRequest$1): Promise<EntityCreationResult>;
12452
+ prepareCreateTopic(req: Omit<CreateTopicRequest, "fundWith">): Promise<PreparedEntityCreation>;
12453
+ executeCreateTopic(req: {
12454
+ entityId: string;
12455
+ chain: ChainType;
12456
+ createTxId: string;
12457
+ securityMode?: EntitySecurityMode;
12458
+ }): Promise<EntityCreationResult>;
12363
12459
  createTopic(req: CreateTopicRequest): Promise<EntityCreationResult>;
12364
12460
  createAgent(req: CreateAgentRequest): Promise<EntityCreationResult>;
12365
12461
  launchpad(req: LaunchpadEntityRequest): Promise<LaunchpadEntityResult>;
@@ -12398,6 +12494,7 @@ declare class BaasClient {
12398
12494
  private readonly timeout;
12399
12495
  private readonly allowInsecure;
12400
12496
  private readonly http;
12497
+ private readonly txHttp;
12401
12498
  private lastHttpError?;
12402
12499
  private authContext?;
12403
12500
  readonly db: DatabaseClient;
@@ -12409,6 +12506,7 @@ declare class BaasClient {
12409
12506
  readonly customerSession: CustomerSessionClient;
12410
12507
  readonly rules: RulesClient;
12411
12508
  readonly entities: EntitiesClient;
12509
+ readonly transactions: TransactionsClient;
12412
12510
  constructor(config: BaasClientConfig);
12413
12511
  static connectToCluster(config: BaasConnectToClusterConfig): Promise<BaasClient>;
12414
12512
  setAppId(appId: string): void;