@zhoujun_aptos/octopus-ts-sdk-min 0.22.6 → 0.22.7

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.
@@ -335,6 +335,38 @@ declare namespace index$2 {
335
335
  export { Ciphertext$3 as Ciphertext, index$2_Key as Key, decrypt$1 as decrypt, encrypt$1 as encrypt, index$2_encryptWithRandomness as encryptWithRandomness, index$2_keygen as keygen };
336
336
  }
337
337
 
338
+ declare class Result<T> {
339
+ isOk: boolean;
340
+ okValue?: T;
341
+ errValue?: any;
342
+ extra?: any;
343
+ private constructor();
344
+ static Ok<T>(args: {
345
+ value: T;
346
+ extra?: any;
347
+ }): Result<T>;
348
+ static Err<T>(args: {
349
+ error: any;
350
+ extra?: any;
351
+ }): Result<T>;
352
+ /**
353
+ * You write a closure that either returns a T or throws, and we wrap it to return a Result<T>.
354
+ * Your closure is also given an `extra` dictionary to record additional context.
355
+ */
356
+ static capture<T>({ task, recordsExecutionTimeMs }: {
357
+ task: (extra: Record<string, any>) => T;
358
+ recordsExecutionTimeMs: boolean;
359
+ }): Result<T>;
360
+ /**
361
+ * You write an async closure that either returns a T or throws, and we wrap it to return a Result<T>.
362
+ * Your closure is also given an `extra` dictionary to record additional context.
363
+ */
364
+ static captureAsync<T>({ task, recordsExecutionTimeMs }: {
365
+ task: (extra: Record<string, any>) => Promise<T>;
366
+ recordsExecutionTimeMs: boolean;
367
+ }): Promise<Result<T>>;
368
+ }
369
+
338
370
  declare class WorkerConfig {
339
371
  expiryTimeMicrosecs: number;
340
372
  endpoint: string;
@@ -353,6 +385,7 @@ declare class WorkerConfig {
353
385
  }
354
386
  declare function view(aptos: Aptos, worker: AccountAddress): Promise<WorkerConfig>;
355
387
  declare function get(workerEndpoint: string): Promise<WorkerConfig>;
388
+ declare function getAsync(workerEndpoint: string): Promise<Result<WorkerConfig>>;
356
389
  declare function randWorker(): {
357
390
  addr: AccountAddress;
358
391
  config: WorkerConfig;
@@ -364,10 +397,11 @@ declare function randWorker(): {
364
397
  type worker_config_WorkerConfig = WorkerConfig;
365
398
  declare const worker_config_WorkerConfig: typeof WorkerConfig;
366
399
  declare const worker_config_get: typeof get;
400
+ declare const worker_config_getAsync: typeof getAsync;
367
401
  declare const worker_config_randWorker: typeof randWorker;
368
402
  declare const worker_config_view: typeof view;
369
403
  declare namespace worker_config {
370
- export { worker_config_WorkerConfig as WorkerConfig, worker_config_get as get, worker_config_randWorker as randWorker, worker_config_view as view };
404
+ export { worker_config_WorkerConfig as WorkerConfig, worker_config_get as get, worker_config_getAsync as getAsync, worker_config_randWorker as randWorker, worker_config_view as view };
371
405
  }
372
406
 
373
407
  /**
@@ -800,7 +834,7 @@ declare class EncryptionKey {
800
834
  });
801
835
  static fetch({ committee }: {
802
836
  committee: Committee;
803
- }): Promise<EncryptionKey>;
837
+ }): Promise<Result<EncryptionKey>>;
804
838
  }
805
839
  declare class DecryptionKey {
806
840
  ibeDecryptionKeys: (IdentityPrivateKey | null)[];
@@ -810,7 +844,8 @@ declare class DecryptionKey {
810
844
  contractId: ContractID;
811
845
  domain: Uint8Array;
812
846
  proof: ProofOfPermission;
813
- }): Promise<DecryptionKey>;
847
+ }): Promise<Result<DecryptionKey>>;
848
+ private static fetchDecKeyShare;
814
849
  }
815
850
  declare class Ciphertext {
816
851
  aesCiph: Ciphertext$3;
@@ -889,7 +924,7 @@ declare function verifyAndExtract({ ibeMsk, committee, contractId, domain, proof
889
924
  contractId: ContractID;
890
925
  domain: Uint8Array;
891
926
  proof: ProofOfPermission;
892
- }): Promise<IdentityPrivateKey>;
927
+ }): Promise<Result<IdentityPrivateKey>>;
893
928
 
894
929
  type index_Ciphertext = Ciphertext;
895
930
  declare const index_Ciphertext: typeof Ciphertext;