wallaby-cash 3.5.2 → 3.7.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/base.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { AuthType, WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions } from './types';
1
+ import { AuthType, WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions, WallabyError, WallabyErrorPayload } from './types';
2
2
  import { StorageService } from './lib/utils/storage.service';
3
3
  import { LocalStorage } from './types/storage';
4
4
  import { LockManagerService } from './helpers/lock-manager.service';
5
5
  import { Cipher } from './lib/utils/cipher.service';
6
+ import { Clock, Ports } from './lib/utils/ports';
6
7
  import { Api as GeneratedApiClient } from './generated/api';
7
8
  export declare abstract class Base {
8
9
  userId: string;
@@ -13,9 +14,11 @@ export declare abstract class Base {
13
14
  protected options?: WallabyConfigOptions;
14
15
  protected lockManager: LockManagerService;
15
16
  protected cipher: Cipher;
17
+ protected transport: typeof fetch;
18
+ protected clock: Clock;
16
19
  private _localStorageService?;
17
20
  protected api: GeneratedApiClient<any>;
18
- constructor(config: WallabyConfig);
21
+ constructor(config: WallabyConfig, ports?: Partial<Ports>);
19
22
  set setClientAuthToken(token: string);
20
23
  get version(): string;
21
24
  private _initializeClientAuthToken;
@@ -40,16 +43,29 @@ export declare abstract class Base {
40
43
  * All concurrent callers share the same in-flight promise via the module-level
41
44
  * `refreshDedupeManager` so only one network request is issued per user/environment scope.
42
45
  */
43
- protected _performTokenRefresh(): Promise<void>;
46
+ protected _performTokenRefresh(opts?: {
47
+ silent?: boolean;
48
+ }): Promise<void>;
49
+ /**
50
+ * Single chokepoint for surfacing transport failures. Every WallabyError raised
51
+ * by a transport path is built here so `options.onError` fires exactly once per
52
+ * logical failure. Retry paths must decide to retry BEFORE calling this so a
53
+ * retried request does not double-fire.
54
+ */
55
+ protected toWallabyError(payload: WallabyErrorPayload): WallabyError;
44
56
  /**
45
57
  * Main request method for making API calls to the Wallaby API.
46
58
  * @param route - Route configuration object containing the endpoint path and HTTP method
47
59
  * @param options - Optional request options including payload and query parameters
48
60
  * @param retried - Internal flag; set to true when retrying after a 401 to prevent loops
61
+ * @param silent - Internal flag; when true the resulting WallabyError does NOT fire
62
+ * `options.onError`. Used for best-effort refreshes whose failure is
63
+ * swallowed by the caller (e.g. proactive refresh in securityWorker),
64
+ * so an internal request never surfaces a consumer-facing error.
49
65
  * @returns Promise resolving to the typed response data
50
66
  * @throws Error if the API returns an error response or network failure occurs
51
67
  */
52
- protected request<T>(route: RequestRoute, options?: RequestOptions, retried?: boolean): Promise<T>;
68
+ protected request<T>(route: RequestRoute, options?: RequestOptions, retried?: boolean, silent?: boolean): Promise<T>;
53
69
  private _getRequestHeaders;
54
70
  protected securityWorker(securityData: any): Promise<any>;
55
71
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Convert a 32-byte seed to Algorand's fixed 25-word mnemonic: 24 data words
3
+ * (256 bits packed into 11-bit BIP39-English word indices) plus a checksum word
4
+ * derived from the first two bytes of the seed's SHA-512/256 hash.
5
+ *
6
+ * Word-for-word compatible with algosdk's `mnemonicFromSeed`; parity is
7
+ * verified against algosdk (devDependency) in `algorand-mnemonic.spec.ts`.
8
+ */
9
+ export declare function algorandMnemonicFromSeed(seed: Uint8Array): string;