wallaby-cash 1.3.17 → 1.5.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.
Files changed (83) hide show
  1. package/README.md +4 -3
  2. package/dist/base.d.ts +31 -30
  3. package/dist/helpers/logger.d.ts +2 -2
  4. package/dist/index.cjs.js +7252 -0
  5. package/dist/index.cjs.js.map +1 -0
  6. package/dist/index.d.ts +46 -45
  7. package/dist/index.esm.js +7242 -1
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +7242 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/lib/auth/index.d.ts +54 -61
  12. package/dist/lib/index.d.ts +4 -4
  13. package/dist/lib/merchants/index.d.ts +59 -59
  14. package/dist/lib/system/index.d.ts +32 -32
  15. package/dist/lib/transactions/index.d.ts +80 -80
  16. package/dist/lib/utils/constants.d.ts +10 -0
  17. package/dist/lib/utils/index.d.ts +62 -49
  18. package/dist/lib/utils/storage.service.d.ts +79 -0
  19. package/dist/lib/wallet/index.d.ts +134 -122
  20. package/dist/routes/auth.d.ts +38 -38
  21. package/dist/routes/index.d.ts +3 -3
  22. package/dist/routes/merchants.d.ts +50 -50
  23. package/dist/routes/system.d.ts +23 -23
  24. package/dist/routes/transactions.d.ts +37 -37
  25. package/dist/routes/wallet.d.ts +58 -58
  26. package/dist/tests/__mocks__/localStorageMock.d.ts +10 -0
  27. package/dist/tests/data/auth.d.ts +11 -11
  28. package/dist/tests/data/config.d.ts +2 -6
  29. package/dist/tests/data/constants.d.ts +5 -0
  30. package/dist/tests/data/index.d.ts +5 -5
  31. package/dist/tests/data/merchants.d.ts +8 -8
  32. package/dist/tests/data/system.d.ts +47 -47
  33. package/dist/tests/data/user.d.ts +22 -21
  34. package/dist/types/auth.d.ts +45 -38
  35. package/dist/types/base.d.ts +53 -0
  36. package/dist/types/common.d.ts +208 -216
  37. package/dist/types/index.d.ts +6 -5
  38. package/dist/types/merchants.d.ts +47 -47
  39. package/dist/types/storage.d.ts +16 -0
  40. package/dist/types/transactions.d.ts +125 -125
  41. package/dist/types/wallet.d.ts +128 -132
  42. package/package.json +48 -30
  43. package/dist/index.umd.js +0 -2
  44. package/dist/index.umd.js.map +0 -1
  45. package/dist/lib/utils/utils.d.ts +0 -77
  46. package/dist/localStorageMock.d.ts +0 -7
  47. package/src/base.ts +0 -152
  48. package/src/helpers/logger.ts +0 -11
  49. package/src/index.ts +0 -58
  50. package/src/lib/auth/index.ts +0 -250
  51. package/src/lib/index.ts +0 -4
  52. package/src/lib/merchants/index.ts +0 -166
  53. package/src/lib/system/index.ts +0 -104
  54. package/src/lib/transactions/index.ts +0 -271
  55. package/src/lib/utils/index.ts +0 -174
  56. package/src/lib/utils/utils.ts +0 -288
  57. package/src/lib/wallet/index.ts +0 -701
  58. package/src/localStorageMock.js +0 -23
  59. package/src/routes/auth.ts +0 -39
  60. package/src/routes/index.ts +0 -3
  61. package/src/routes/merchants.ts +0 -39
  62. package/src/routes/system.ts +0 -24
  63. package/src/routes/transactions.ts +0 -50
  64. package/src/routes/wallet.ts +0 -70
  65. package/src/tests/__mocks__/axios.js +0 -4
  66. package/src/tests/__mocks__/localStorageMock.js +0 -23
  67. package/src/tests/auth.spec.ts +0 -125
  68. package/src/tests/data/auth.ts +0 -49
  69. package/src/tests/data/config.ts +0 -8
  70. package/src/tests/data/index.ts +0 -5
  71. package/src/tests/data/merchants.ts +0 -8
  72. package/src/tests/data/system.ts +0 -54
  73. package/src/tests/data/user.ts +0 -26
  74. package/src/tests/merchants.spec.ts +0 -72
  75. package/src/tests/system.spec.ts +0 -45
  76. package/src/tests/utils.spec.ts +0 -66
  77. package/src/tests/wallet.spec.ts +0 -50
  78. package/src/types/auth.ts +0 -45
  79. package/src/types/common.ts +0 -242
  80. package/src/types/index.ts +0 -5
  81. package/src/types/merchants.ts +0 -52
  82. package/src/types/transactions.ts +0 -138
  83. package/src/types/wallet.ts +0 -151
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Getting started
2
2
 
3
3
  ## Overview
4
+ [![npm version](https://badge.fury.io/js/wallaby-cash.svg)](https://badge.fury.io/js/wallaby-cash)
4
5
 
5
6
  The SDK leverages Wallaby API as a gateway to web3 and the blockchain.
6
7
 
@@ -20,11 +21,11 @@ The SDK currently supports the following blockchains:
20
21
  After installing the library, you can then import and use the SDK.
21
22
 
22
23
  Some configuration params are optional depending on the endpoint.
23
- `apiKey`, `baseUrl` and `jwt` are always required, while `userId` and `accessToken` are only required for certain endpoints.
24
+ `apiKey`, `baseUrl` and `clientAuthToken` are always required, while `userId` and `accessToken` are only required for certain endpoints.
24
25
 
25
26
  To initialize the Wallaby client, simply import the Wallaby class and pass the config object.
26
27
 
27
- To understand how to generate and use the `jwt` you can refer to authentication docs [here](./authentication/overview#how-to-generate-the-client-jwt).
28
+ To understand how to generate and use the `clientAuthToken` you can refer to authentication docs [here](./authentication/overview#how-to-generate-the-client-jwt).
28
29
 
29
30
  **Example:**
30
31
 
@@ -34,7 +35,7 @@ import { Wallaby } from 'wallaby-cash';
34
35
  const config = {
35
36
  apiKey: "071b51027b412a1b8fcttt73684d25mi"
36
37
  baseUrl: "https://dev-testnet.wallaby.cash",
37
- jwt: `eyJhbGciOiJSUzI1NiJ9. eyJleHRlcm5hbFVzZXJJZCI6IjU0MDc1ZWNmLWE3MjktNDUxNy05NmE1LTZkMzcwNzFmYTEzZSIsImV4cGlyYXRpb24iOiIyMDIzLTA0LTI1VDExOjU4OjExLTA1OjAwIiwiaGFzaF9zdHJpbmciOiIxOGU4ZDY1NWJmNjUwYmJkZWFlNWEzNjBkMTU1M2Q5YWVkYjU1MjI4NGYxOWZmMDViMzgxZWI0ZjcxNDA2MjQ2In0.jnsGd-H0rBXLQVHLKq2yMNLcvlDKOg1i863czVPLg0sDaO6hDLIez2zfhsEvGAZQCbYKWIAj7KmuCIFLGL5B74eu-__d_OzO2fTGJthzud-MlWcWAjXYnHjGS6WCZ5M_D_i-kyZow9N9SmSX4ccdFV4yPmQVYojqDqBAWlVXddU`,
38
+ clientAuthToken: `eyJhbGciOiJSUzI1NiJ9. eyJleHRlcm5hbFVzZXJJZCI6IjU0MDc1ZWNmLWE3MjktNDUxNy05NmE1LTZkMzcwNzFmYTEzZSIsImV4cGlyYXRpb24iOiIyMDIzLTA0LTI1VDExOjU4OjExLTA1OjAwIiwiaGFzaF9zdHJpbmciOiIxOGU4ZDY1NWJmNjUwYmJkZWFlNWEzNjBkMTU1M2Q5YWVkYjU1MjI4NGYxOWZmMDViMzgxZWI0ZjcxNDA2MjQ2In0.jnsGd-H0rBXLQVHLKq2yMNLcvlDKOg1i863czVPLg0sDaO6hDLIez2zfhsEvGAZQCbYKWIAj7KmuCIFLGL5B74eu-__d_OzO2fTGJthzud-MlWcWAjXYnHjGS6WCZ5M_D_i-kyZow9N9SmSX4ccdFV4yPmQVYojqDqBAWlVXddU`,
38
39
  userId: "54075ecf-a729-4517-96a5-6d37071fa13e",
39
40
  }
40
41
 
package/dist/base.d.ts CHANGED
@@ -1,30 +1,31 @@
1
- import { WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions } from './types';
2
- export declare abstract class Base {
3
- private apiKey;
4
- private baseUrl;
5
- userId: string;
6
- jwt?: string;
7
- options?: WallabyConfigOptions;
8
- constructor(config: WallabyConfig);
9
- protected get device(): {
10
- authTokens: {
11
- accessToken: import("./types").UtilsResponse | import("./types").WallabyError;
12
- clientAuthToken: string | undefined;
13
- };
14
- user: {
15
- clientUserId: string;
16
- encryptedStandardSeedPhrase: string | undefined;
17
- encryptedAlgorandSeedPhrase: string | undefined;
18
- wallabyUserId: undefined;
19
- };
20
- encryptionKeys: {
21
- deviceEncryptedPrivateKey: import("./types").UtilsResponse;
22
- devicePublicKey: undefined;
23
- apiPublicKey: import("./types").UtilsResponse;
24
- };
25
- };
26
- private get settings();
27
- protected request<T>(route: RequestRoute, options?: RequestOptions): Promise<T | any>;
28
- private getRequestHeaders;
29
- private loadDeviceInformation;
30
- }
1
+ import { WallabyConfig, RequestOptions, RequestRoute, WallabyConfigOptions } from './types';
2
+ import StorageService from './lib/utils/storage.service';
3
+ import { LocalStorage } from './types/storage';
4
+ export declare abstract class Base {
5
+ private apiKey;
6
+ private baseUrl;
7
+ private jwt;
8
+ private clientAuthToken;
9
+ userId: string;
10
+ options?: WallabyConfigOptions;
11
+ constructor(config: WallabyConfig);
12
+ /**
13
+ * @description This library uses `localStorage` as the default storage.
14
+ * If you want to use a different storage, you can pass it in the options object of the Wallaby config.
15
+ * storage: new CustomStorage()
16
+ * {
17
+ * }
18
+ *
19
+ */
20
+ get deviceStorage(): LocalStorage;
21
+ get device(): Promise<import("./types").DeviceInformation>;
22
+ get settings(): {
23
+ apiKey: string;
24
+ baseUrl: string;
25
+ environment: string;
26
+ network: "mainnet" | "testnet";
27
+ };
28
+ get storageService(): StorageService;
29
+ protected request<T>(route: RequestRoute, options?: RequestOptions): Promise<T | any>;
30
+ private getRequestHeaders;
31
+ }
@@ -1,2 +1,2 @@
1
- declare const logger: (message: string, data?: any) => void;
2
- export default logger;
1
+ declare const logger: (message: string, data?: any) => void;
2
+ export default logger;