wallaby-cash 3.2.0 → 3.3.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.
@@ -15,6 +15,13 @@ export declare class AuthService extends Base {
15
15
  * @returns { boolean } Returns true if the user is authenticated, false otherwise.
16
16
  */
17
17
  validateSession(): Promise<boolean>;
18
+ /**
19
+ * @description Refreshes auth tokens using the stored refresh token.
20
+ */
21
+ refreshAuthTokens(): Promise<{
22
+ accessToken: string;
23
+ refreshToken: string;
24
+ }>;
18
25
  /**
19
26
  * @description Validates the user's password by decrypting the stored private key.
20
27
  * @returns { boolean } Returns true if the password is valid, false otherwise.
@@ -1,5 +1,6 @@
1
1
  import { Base } from '../../base';
2
- import { WallabyConfig, TokenStandard, FeeEstimatesResponse, Transaction, BlockchainName, GetPendingTransactionsRequest, GetPendingTransactionsResponse, ResolvePendingTransactionRequest, ResolvePendingTransactionResponse, TransactionResponse, FeeEstimateRequest } from '../../types';
2
+ import { WallabyConfig, FeeEstimatesResponse, BlockchainName, GetPendingTransactionsRequest, GetPendingTransactionsResponse, ResolvePendingTransactionRequest, ResolvePendingTransactionResponse, TransactionResponse, FeeEstimateRequest } from '../../types';
3
+ import { DetectRestrictionResponseDto, GetRestrictionParams, GetTransactionsParams, GetTransactionsResponseDto } from '../../generated/api';
3
4
  import { CreateAllowanceRequest, TransactionStatusResponse, TransferRequest } from '../../types';
4
5
  export declare class Transactions extends Base {
5
6
  private authService;
@@ -35,19 +36,24 @@ export declare class Transactions extends Base {
35
36
  /**
36
37
  *
37
38
  * @public
38
- * @param {string} address
39
- * @param {string} symbol
40
- * @param {TokenStandard} tokenStandard an optional param used when dealing with non native assets
41
- * @returns {Promise<{ address: string; transactions: Transaction[] }>}
39
+ * @param {GetTransactionsParams} params - Query parameters for filtering and paginating transactions
40
+ * @returns {GetTransactionsResponseDto} Paginated list of transactions matching the given criteria
42
41
  */
43
- getTransactions({ address, symbol, tokenStandard, }: {
44
- address: string;
45
- symbol: string;
46
- tokenStandard?: TokenStandard;
47
- }): Promise<{
48
- address: string;
49
- transactions: Transaction[];
50
- } | undefined>;
42
+ getTransactions(params: GetTransactionsParams): Promise<GetTransactionsResponseDto>;
43
+ /**
44
+ *
45
+ * @public
46
+ * @param {GetRestrictionParams} params - Parameters to detect transfer restrictions (addresses, asset, value)
47
+ * - {string} fromAddress
48
+ * - {string} toAddress
49
+ * - {string} amount
50
+ * - [string] assetId
51
+ * - [string] contractAddress
52
+ * - [BlockchainName] blockchainName
53
+ * @returns {Promise<DetectRestrictionResponseDto>}
54
+ * Detection result; when transfer is blocked, also includes the human-readable restriction message and a boolean canTransfer
55
+ */
56
+ getRestriction(params: GetRestrictionParams): Promise<DetectRestrictionResponseDto>;
51
57
  /**
52
58
  *
53
59
  * @public
@@ -7,6 +7,14 @@
7
7
  export declare function jwtHasExpired(jwt: string | null): boolean;
8
8
  export declare function jwtHasSameUser(jwt: string | null, userId: string): boolean;
9
9
  export declare function userIsMfaVerified(jwt: string): boolean;
10
+ /**
11
+ * Checks if a given JWT will expire within the given threshold.
12
+ *
13
+ * @param jwt - The JWT string to check. If null, the function returns false.
14
+ * @param thresholdSeconds - Number of seconds before expiry to consider "near expiry".
15
+ * @returns `true` if the JWT expires within `thresholdSeconds` seconds, otherwise `false`.
16
+ */
17
+ export declare function isJwtNearExpiry(jwt: string | null, thresholdSeconds: number): boolean;
10
18
  /**
11
19
  * Calculates the remaining time in milliseconds until a given JWT expires.
12
20
  *
@@ -7,7 +7,9 @@ export declare class WalletHandlersService extends Base {
7
7
  handleImportWallet(deviceAuthKeys: {
8
8
  publicKey: string;
9
9
  privateKey: string;
10
- }, importWalletInput: ImportWalletRequest): Promise<ImportWalletResponse>;
10
+ }, importWalletInput: ImportWalletRequest & {
11
+ reference: string;
12
+ }): Promise<ImportWalletResponse>;
11
13
  /**
12
14
  * Handles the creation of a wallet, including generating signatures, validating input,
13
15
  * and processing the wallet creation response.
@@ -26,7 +28,7 @@ export declare class WalletHandlersService extends Base {
26
28
  wallabyAuthPubKey: string;
27
29
  assets: Array<import("../../types").UserAsset>;
28
30
  encryptedSeed?: Encrypted;
29
- shares?: import("../../types").Share[];
31
+ shares?: KeyShareDto[];
30
32
  encryptedBackupShare?: Encrypted | SymmetricEncrypted;
31
33
  reference: string;
32
34
  wallet: import("../../types").Wallet;
package/dist/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "wallaby-cash",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
- "url": "git@github.com:WALLABY-WaaS/wallaby-sdk-js.git"
6
+ "url": "https://github.com/WALLABY-WaaS/wallaby-sdk-js"
7
7
  },
8
8
  "main": "./dist/index.cjs.js",
9
9
  "module": "./dist/index.esm.js",
@@ -36,7 +36,9 @@
36
36
  "build": "rollup --config --sourcemap --validate --bundleConfigAsCjs",
37
37
  "build:prod": "npm run build --compact --environment production",
38
38
  "build:dev": "npm run generate:types && rollup --config --bundleConfigAsCjs --watch",
39
+ "pretest": "node scripts/check-test-guards.mjs",
39
40
  "test": "NODE_ENV=test jest",
41
+ "check:no-skips": "node scripts/check-test-guards.mjs",
40
42
  "merge-coverage": "mkdir -p .nyc_output && npx istanbul-merge --out .nyc_output/out.json coverage/coverage-final.json && npx nyc report --reporter=json-summary --reporter=text-summary --report-dir=coverage && npx nyc check-coverage",
41
43
  "test:coverage": "NODE_ENV=test npm run test --coverage",
42
44
  "test:watch": "NODE_ENV=test jest --watch",
@@ -48,7 +50,7 @@
48
50
  "docs:generate": "npx typedoc",
49
51
  "generate:types": "node scripts/generate-api-types.mjs",
50
52
  "generate:types:local": "node scripts/generate-api-types.mjs --local",
51
- "release": "npm publish --access-public",
53
+ "release": "npm publish",
52
54
  "release:alpha": "npm run build && npm publish --tag alpha",
53
55
  "release:native": "npm run build && npm publish --tag native",
54
56
  "release:beta": "npm run build && npm publish --tag beta",
@@ -125,19 +127,21 @@
125
127
  }
126
128
  },
127
129
  "overrides": {
130
+ "@babel/core": "^7.29.6",
128
131
  "lodash": "^4.18.0",
129
132
  "@tootallnate/once": "^3.0.1",
130
133
  "markdown-it": "^14.1.1",
131
134
  "defu": "^6.1.5",
132
135
  "diff": "^5.2.2",
133
- "tar": "^7.5.10",
136
+ "tar": "^7.5.16",
134
137
  "jsdom": {
135
138
  "ws": "^8.20.1"
136
139
  },
137
140
  "undici": "^7.19.0",
138
- "js-yaml": "^4.1.1",
141
+ "js-yaml": "^4.2.0",
139
142
  "pbkdf2": "^3.1.3",
140
- "esbuild": "^0.25.0",
143
+ "esbuild": "^0.28.1",
144
+ "form-data": "^4.0.6",
141
145
  "ws": "^8.20.1",
142
146
  "@octokit/core": "^6.1.0",
143
147
  "@octokit/request": "^8.4.1",
@@ -166,9 +170,9 @@
166
170
  ],
167
171
  "nyc": {
168
172
  "check-coverage": true,
169
- "lines": 70,
170
- "statements": 71,
171
- "functions": 61,
172
- "branches": 38
173
+ "lines": 88,
174
+ "statements": 88,
175
+ "functions": 92,
176
+ "branches": 82
173
177
  }
174
178
  }
@@ -30,6 +30,21 @@ export declare const TransactionsRoutes: {
30
30
  method: RequestMethod;
31
31
  requiresAccessToken: boolean;
32
32
  };
33
+ detectTransferRestrictions: {
34
+ fullPath: string;
35
+ method: RequestMethod;
36
+ requiresAccessToken: boolean;
37
+ };
38
+ transferRestrictionMessage: {
39
+ fullPath: string;
40
+ method: RequestMethod;
41
+ requiresAccessToken: boolean;
42
+ };
43
+ restriction: {
44
+ fullPath: string;
45
+ method: RequestMethod;
46
+ requiresAccessToken: boolean;
47
+ };
33
48
  getPendingTransactions: {
34
49
  fullPath: string;
35
50
  method: RequestMethod;
@@ -266,7 +266,7 @@ export declare type ClientAuthPubKeyResponse = {
266
266
  };
267
267
  export declare type RefreshAccessTokenResponse = {
268
268
  accessToken: string;
269
- idToken: string;
269
+ refreshToken: string;
270
270
  /** @deprecated */
271
271
  error?: any;
272
272
  };
@@ -10,12 +10,19 @@ export declare enum ErrorResponseCodes {
10
10
  'auth_api_jwt_invalid' = "auth_api_jwt_invalid",
11
11
  'auth_api_jwt_not_active' = "auth_api_jwt_not_active",
12
12
  'auth_api_jwt_not_provided' = "auth_api_jwt_not_provided",
13
+ 'auth_api_jwt_expired' = "auth_api_jwt_expired",
14
+ 'auth_api_unauthorized' = "auth_api_unauthorized",
15
+ 'auth_refresh_token_not_found' = "auth_refresh_token_not_found",
16
+ 'auth_refresh_token_expired' = "auth_refresh_token_expired",
17
+ 'auth_refresh_token_reuse_detected' = "auth_refresh_token_reuse_detected",
13
18
  'auth_client_jwt_invalid' = "auth_client_jwt_invalid",
14
19
  'auth_client_jwt_missing_external_id_payload' = "auth_client_jwt_missing_external_id_payload",
15
20
  'auth_client_jwt_missing_exp_payload' = "auth_client_jwt_missing_exp_payload",
16
21
  'auth_client_jwt_external_id_not_match' = "auth_client_jwt_external_id_not_match",
17
22
  'auth_client_jwt_expired' = "auth_client_jwt_expired",
18
23
  'auth_client_jwt_not_provided' = "auth_client_jwt_not_provided",
24
+ 'auth_client_jwt_invalid_auth_type' = "auth_client_jwt_invalid_auth_type",
25
+ 'auth_client_jwt_invalid_passkey' = "auth_client_jwt_invalid_passkey",
19
26
  'auth_client_pub_key_and_message_not_match' = "auth_client_pub_key_and_message_not_match",
20
27
  'auth_client_pub_key_and_message_expired' = "auth_client_pub_key_and_message_expired",
21
28
  'auth_client_pub_key_and_message_signature_failed' = "auth_client_pub_key_and_message_signature_failed",
@@ -40,6 +47,7 @@ export declare enum ErrorResponseCodes {
40
47
  'sdk_seed_phrase_not_found' = "sdk_seed_phrase_not_found",
41
48
  'sdk_private_key_decryption_failed' = "sdk_private_key_decryption_failed",
42
49
  'sdk_private_key_not_found' = "sdk_private_key_not_found",
50
+ 'sdk_refresh_token_missing' = "sdk_refresh_token_missing",
43
51
  'sdk_missing_parameter' = "sdk_missing_parameter",
44
52
  'sdk_invalid_parameter' = "sdk_invalid_parameter",
45
53
  'sdk_wrong_password' = "sdk_wrong_password",
@@ -1,4 +1,4 @@
1
- import { UpdateUserAssetRequestDto, WalletAddress } from '../generated/api';
1
+ import { KeyShareDto, UpdateUserAssetRequestDto, WalletAddress } from '../generated/api';
2
2
  import { AuthenticationResponse, AuthResponse } from './auth';
3
3
  import { UserAsset, TokenStandard, User, BlockchainName, Encrypted, BasicQueryOptions, AssetConfig } from './common';
4
4
  import { Merchant } from './merchants';
@@ -153,7 +153,7 @@ export declare type CreateWalletResponse = {
153
153
  wallabyAuthPubKey: string;
154
154
  assets: Array<UserAsset>;
155
155
  encryptedSeed?: Encrypted;
156
- shares?: Share[];
156
+ shares?: KeyShareDto[];
157
157
  encryptedBackupShare?: Encrypted | SymmetricEncrypted;
158
158
  standardSeedPhrase?: string;
159
159
  reference: string;
@@ -188,7 +188,7 @@ export declare type ImportWalletResponse = {
188
188
  assets: Array<UserAsset>;
189
189
  walletAddressesInfo: WalletAddressesInfoEntry[];
190
190
  encryptedSeed?: Encrypted;
191
- shares?: Share[];
191
+ shares?: KeyShareDto[];
192
192
  encryptedBackupShare?: Encrypted | SymmetricEncrypted;
193
193
  wallet: Wallet;
194
194
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wallaby-cash",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/WALLABY-WaaS/wallaby-sdk-js"
@@ -36,7 +36,9 @@
36
36
  "build": "rollup --config --sourcemap --validate --bundleConfigAsCjs",
37
37
  "build:prod": "npm run build --compact --environment production",
38
38
  "build:dev": "npm run generate:types && rollup --config --bundleConfigAsCjs --watch",
39
+ "pretest": "node scripts/check-test-guards.mjs",
39
40
  "test": "NODE_ENV=test jest",
41
+ "check:no-skips": "node scripts/check-test-guards.mjs",
40
42
  "merge-coverage": "mkdir -p .nyc_output && npx istanbul-merge --out .nyc_output/out.json coverage/coverage-final.json && npx nyc report --reporter=json-summary --reporter=text-summary --report-dir=coverage && npx nyc check-coverage",
41
43
  "test:coverage": "NODE_ENV=test npm run test --coverage",
42
44
  "test:watch": "NODE_ENV=test jest --watch",
@@ -125,19 +127,21 @@
125
127
  }
126
128
  },
127
129
  "overrides": {
130
+ "@babel/core": "^7.29.6",
128
131
  "lodash": "^4.18.0",
129
132
  "@tootallnate/once": "^3.0.1",
130
133
  "markdown-it": "^14.1.1",
131
134
  "defu": "^6.1.5",
132
135
  "diff": "^5.2.2",
133
- "tar": "^7.5.10",
136
+ "tar": "^7.5.16",
134
137
  "jsdom": {
135
138
  "ws": "^8.20.1"
136
139
  },
137
140
  "undici": "^7.19.0",
138
- "js-yaml": "^4.1.1",
141
+ "js-yaml": "^4.2.0",
139
142
  "pbkdf2": "^3.1.3",
140
143
  "esbuild": "^0.28.1",
144
+ "form-data": "^4.0.6",
141
145
  "ws": "^8.20.1",
142
146
  "@octokit/core": "^6.1.0",
143
147
  "@octokit/request": "^8.4.1",
@@ -166,9 +170,9 @@
166
170
  ],
167
171
  "nyc": {
168
172
  "check-coverage": true,
169
- "lines": 70,
170
- "statements": 71,
171
- "functions": 61,
172
- "branches": 38
173
+ "lines": 88,
174
+ "statements": 88,
175
+ "functions": 92,
176
+ "branches": 82
173
177
  }
174
178
  }