wallaby-cash 2.3.0-alpha.2 → 2.3.2

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 (37) hide show
  1. package/README.md +69 -0
  2. package/dist/generated/api.d.ts +1369 -2674
  3. package/dist/helpers/base64.base.d.ts +12 -0
  4. package/dist/helpers/base64.d.ts +6 -0
  5. package/dist/helpers/base64.native.d.ts +6 -0
  6. package/dist/helpers/normalize-storage-keys.d.ts +8 -0
  7. package/dist/index.cjs.js +1049 -605
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.esm.js +1049 -605
  11. package/dist/index.esm.js.map +1 -1
  12. package/dist/index.js +1212 -645
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/auth/auth.service.d.ts +1 -1
  15. package/dist/lib/auth/authenticator.d.ts +3 -3
  16. package/dist/lib/auth/authenticator.native.d.ts +36 -0
  17. package/dist/lib/auth/passkey.model.d.ts +10 -3
  18. package/dist/lib/auth/passkey.service.base.d.ts +76 -0
  19. package/dist/lib/auth/passkey.service.d.ts +1 -76
  20. package/dist/lib/auth/passkey.service.native.d.ts +4 -0
  21. package/dist/lib/index.d.ts +1 -0
  22. package/dist/lib/swap/index.d.ts +36 -0
  23. package/dist/lib/system/index.d.ts +14 -4
  24. package/dist/lib/transactions/index.d.ts +4 -2
  25. package/dist/lib/utils/constants.d.ts +1 -1
  26. package/dist/lib/wallet/wallet-data.service.d.ts +8 -6
  27. package/dist/package.json +23 -12
  28. package/dist/routes/index.d.ts +1 -0
  29. package/dist/routes/swap.d.ts +24 -0
  30. package/dist/types/auth.d.ts +152 -4
  31. package/dist/types/common.d.ts +3 -0
  32. package/dist/types/error-response-codes.d.ts +1 -0
  33. package/dist/types/index.d.ts +1 -0
  34. package/dist/types/swap.d.ts +95 -0
  35. package/dist/types/transactions.d.ts +1 -0
  36. package/dist/types/wallet.d.ts +2 -4
  37. package/package.json +23 -12
@@ -1,6 +1,154 @@
1
- import { AttestationFormat, AuthenticationExtensionsClientInputs, AuthenticatorAssertionResponseJSON, AuthenticatorTransportFuture, PublicKeyCredentialHint, PublicKeyCredentialDescriptorJSON, PublicKeyCredentialUserEntityJSON } from '@simplewebauthn/browser';
2
- import * as WebAuthn from '@simplewebauthn/browser';
3
1
  import { User, Base64URLString } from './common';
2
+ /**
3
+ * Local WebAuthn type definitions (duplicated from @simplewebauthn/browser to avoid dependency)
4
+ * These match the WebAuthn specification and @simplewebauthn/browser types
5
+ */
6
+ /**
7
+ * Values for an attestation object's `fmt` field
8
+ * https://w3c.github.io/webauthn/#sctn-attestation-formats
9
+ */
10
+ export type AttestationFormat = 'android-key' | 'android-safetynet' | 'apple' | 'fido-u2f' | 'none' | 'packed' | 'tpm';
11
+ /**
12
+ * Authenticator attachment hint
13
+ * https://w3c.github.io/webauthn/#enumdef-authenticatorattachment
14
+ */
15
+ export type AuthenticatorAttachment = 'cross-platform' | 'platform';
16
+ /**
17
+ * Public key credential type
18
+ * https://w3c.github.io/webauthn/#enumdef-publickeycredentialtype
19
+ */
20
+ export type PublicKeyCredentialType = 'public-key';
21
+ /**
22
+ * User verification requirement
23
+ * https://w3c.github.io/webauthn/#enumdef-userverificationrequirement
24
+ */
25
+ export type UserVerificationRequirement = 'required' | 'preferred' | 'discouraged';
26
+ /**
27
+ * Attestation conveyance preference
28
+ * https://w3c.github.io/webauthn/#enumdef-attestationconveyancepreference
29
+ */
30
+ export type AttestationConveyancePreference = 'none' | 'indirect' | 'direct' | 'enterprise';
31
+ /**
32
+ * COSE algorithm identifier
33
+ * https://www.iana.org/assignments/cose/cose.xhtml#algorithms
34
+ */
35
+ export type COSEAlgorithmIdentifier = number;
36
+ /**
37
+ * Authenticator transport
38
+ * https://w3c.github.io/webauthn/#enumdef-authenticatortransport
39
+ */
40
+ export type AuthenticatorTransport = 'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid';
41
+ /**
42
+ * Future authenticator transport (includes newer transports)
43
+ */
44
+ export type AuthenticatorTransportFuture = AuthenticatorTransport | 'cable' | 'smart-card';
45
+ /**
46
+ * Public key credential hint
47
+ * Categories of authenticators that Relying Parties can pass along to browsers
48
+ * https://w3c.github.io/webauthn/#enumdef-publickeycredentialhint
49
+ */
50
+ export type PublicKeyCredentialHint = 'security-key' | 'client-device' | 'hybrid';
51
+ /**
52
+ * Buffer source (ArrayBuffer or ArrayBufferView)
53
+ */
54
+ export type BufferSource = ArrayBuffer | ArrayBufferView;
55
+ /**
56
+ * Public Key Credential Descriptor JSON
57
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptorjson
58
+ */
59
+ export interface PublicKeyCredentialDescriptorJSON {
60
+ id: Base64URLString;
61
+ type: PublicKeyCredentialType;
62
+ transports?: AuthenticatorTransportFuture[];
63
+ }
64
+ /**
65
+ * Public Key Credential User Entity JSON
66
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentityjson
67
+ */
68
+ export interface PublicKeyCredentialUserEntityJSON {
69
+ id: Base64URLString;
70
+ name: string;
71
+ displayName: string;
72
+ }
73
+ /**
74
+ * Public Key Credential RP Entity
75
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialrpentity
76
+ */
77
+ export interface PublicKeyCredentialRpEntity {
78
+ id: string;
79
+ name: string;
80
+ }
81
+ /**
82
+ * Public Key Credential Parameters
83
+ * https://w3c.github.io/webauthn/#dictdef-publickeycredentialparameters
84
+ */
85
+ export interface PublicKeyCredentialParameters {
86
+ type: PublicKeyCredentialType;
87
+ alg: COSEAlgorithmIdentifier;
88
+ }
89
+ /**
90
+ * Resident Key Requirement
91
+ * https://w3c.github.io/webauthn/#enumdef-residentkeyrequirement
92
+ */
93
+ export type ResidentKeyRequirement = 'required' | 'preferred' | 'discouraged';
94
+ /**
95
+ * Authenticator Selection Criteria
96
+ * https://w3c.github.io/webauthn/#dictdef-authenticatorselectioncriteria
97
+ */
98
+ export interface AuthenticatorSelectionCriteria {
99
+ authenticatorAttachment?: AuthenticatorAttachment;
100
+ requireResidentKey?: boolean;
101
+ residentKey?: ResidentKeyRequirement;
102
+ userVerification?: UserVerificationRequirement;
103
+ }
104
+ /**
105
+ * Authenticator Response (base interface)
106
+ */
107
+ export interface AuthenticatorResponse {
108
+ clientDataJSON: ArrayBuffer;
109
+ }
110
+ /**
111
+ * Authenticator Assertion Response
112
+ * https://w3c.github.io/webauthn/#dictdef-authenticatorassertionresponse
113
+ */
114
+ export interface AuthenticatorAssertionResponse {
115
+ authenticatorData: ArrayBuffer;
116
+ signature: ArrayBuffer;
117
+ userHandle: ArrayBuffer | null;
118
+ }
119
+ /**
120
+ * Authenticator Assertion Response JSON
121
+ * Base64URL-encoded version for JSON transmission
122
+ */
123
+ export interface AuthenticatorAssertionResponseJSON {
124
+ clientDataJSON: Base64URLString;
125
+ authenticatorData: Base64URLString;
126
+ signature: Base64URLString;
127
+ /** @see https://w3c.github.io/webauthn/#dom-authenticatorassertionresponse-userhandle - may be undefined when not returned by authenticator */
128
+ userHandle?: Base64URLString | null;
129
+ }
130
+ /**
131
+ * Authentication Extensions Client Inputs
132
+ * https://w3c.github.io/webauthn/#dictdef-authenticationextensionsclientinputs
133
+ */
134
+ export interface AuthenticationExtensionsClientInputs {
135
+ appid?: string;
136
+ credProps?: boolean;
137
+ hmacCreateSecret?: boolean;
138
+ minPinLength?: boolean;
139
+ [key: string]: unknown;
140
+ }
141
+ /**
142
+ * Authentication Extensions Client Outputs
143
+ * https://w3c.github.io/webauthn/#dictdef-authenticationextensionsclientoutputs
144
+ */
145
+ export interface AuthenticationExtensionsClientOutputs {
146
+ appid?: boolean;
147
+ credProps?: {
148
+ rk?: boolean;
149
+ };
150
+ hmacCreateSecret?: boolean;
151
+ }
4
152
  /**
5
153
  * A slightly-modified RegistrationCredential to simplify working with ArrayBuffers that
6
154
  * are Base64URL-encoded in the browser so that they can be sent as JSON to the server.
@@ -153,12 +301,12 @@ export type ExtendedAuthenticatorResponse = AuthenticatorResponse & {
153
301
  authenticatorData: ArrayBuffer;
154
302
  userHandle: ArrayBuffer;
155
303
  };
156
- export type ExtendedAuthenticationExtensionsClientOutputs = WebAuthn.AuthenticationExtensionsClientOutputs & PRFExtension;
304
+ export type ExtendedAuthenticationExtensionsClientOutputs = AuthenticationExtensionsClientOutputs & PRFExtension;
157
305
  export type ExtendedAuthenticationExtensionsClientInputs = AuthenticationExtensionsClientInputs & {
158
306
  prf: AuthenticationExtensionsPRFInputs;
159
307
  };
160
308
  export interface AuthenticationExtensionsPRFValues {
161
- base64: Base64URLString;
309
+ base64?: Base64URLString;
162
310
  first: BufferSource;
163
311
  second?: BufferSource;
164
312
  }
@@ -72,6 +72,7 @@ export declare type UserAsset = {
72
72
  walletId: string | null;
73
73
  isVisible: boolean;
74
74
  requiresKyc?: boolean;
75
+ supportsSwaps?: boolean;
75
76
  };
76
77
  export declare type Address = {
77
78
  address: string;
@@ -110,6 +111,7 @@ export declare type AssetConfig = {
110
111
  multisigSignerThreshold: number;
111
112
  chain?: Blockchain;
112
113
  requiresKyc?: boolean;
114
+ supportsSwaps?: boolean;
113
115
  };
114
116
  export declare enum UserAssetSource {
115
117
  Merchant = "merchant",
@@ -167,6 +169,7 @@ export declare type Blockchain = {
167
169
  updatedAt: Date | string;
168
170
  assets: AssetConfig[];
169
171
  merchantAssets: MerchantAsset[];
172
+ supportsSwaps?: boolean;
170
173
  };
171
174
  export declare enum BlockchainStatus {
172
175
  Up = "UP",
@@ -43,6 +43,7 @@ export declare enum ErrorResponseCodes {
43
43
  'sdk_missing_parameter' = "sdk_missing_parameter",
44
44
  'sdk_invalid_parameter' = "sdk_invalid_parameter",
45
45
  'sdk_wrong_password' = "sdk_wrong_password",
46
+ 'sdk_no_valid_seed_option' = "sdk_no_valid_seed_option",
46
47
  'sdk_passkey_prf_not_available' = "sdk_passkey_prf_not_available",
47
48
  'sdk_passkey_challenge_unavailable' = "sdk_passkey_challenge_unavailable",
48
49
  'sdk_passkey_authentication_failed' = "sdk_passkey_authentication_failed",
@@ -7,3 +7,4 @@ export * from './base';
7
7
  export * from './storage';
8
8
  export * from './error-response-codes';
9
9
  export * from './passkey-error-codes';
10
+ export * from './swap';
@@ -0,0 +1,95 @@
1
+ import { AuthenticationResponse } from './auth';
2
+ import { PaginationInterface } from './common';
3
+ /**
4
+ * Request to get a swap quote
5
+ */
6
+ export declare type SwapQuoteRequest = {
7
+ walletId: string;
8
+ fromAsset: string;
9
+ toAsset: string;
10
+ fromAmount?: string;
11
+ toAmount?: string;
12
+ };
13
+ /**
14
+ * Response from swap quote endpoint
15
+ */
16
+ export declare type SwapQuoteResponse = {
17
+ id: string;
18
+ gasFeeInUSD: string;
19
+ otherFeesInUSD: string;
20
+ fromAssetConfigId: string;
21
+ fromAssetSymbol: string;
22
+ fromAssetChain: string;
23
+ toAssetConfigId: string;
24
+ toAssetSymbol: string;
25
+ toAssetChain: string;
26
+ fromAmount: string;
27
+ fromAddress: string;
28
+ toAmount: string;
29
+ toAddress: string;
30
+ slippage: number;
31
+ expiresAt?: string;
32
+ };
33
+ /**
34
+ * Request to execute a swap
35
+ */
36
+ export declare type ExecuteSwapRequest = {
37
+ walletId: string;
38
+ quoteId: string;
39
+ authenticationOptions: AuthenticationResponse;
40
+ };
41
+ /**
42
+ * Response from execute swap endpoint
43
+ */
44
+ export declare type ExecuteSwapResponse = {
45
+ swapQuoteId: string;
46
+ status: 'in_progress' | 'completed' | 'failed';
47
+ transactionHash: string;
48
+ explorerLink: string;
49
+ };
50
+ /**
51
+ * Query parameters for getting swaps list
52
+ */
53
+ export declare type GetSwapsQueryParams = {
54
+ startDate?: string;
55
+ endDate?: string;
56
+ limit?: number;
57
+ offset?: number;
58
+ };
59
+ /**
60
+ * Request to get swaps list
61
+ */
62
+ export declare type GetSwapsRequest = {
63
+ walletId: string;
64
+ queryParams?: GetSwapsQueryParams;
65
+ };
66
+ /**
67
+ * Swap transaction data
68
+ */
69
+ export declare type SwapTransaction = {
70
+ id: string;
71
+ fromAssetSymbol: string;
72
+ fromAssetChainName: string;
73
+ toAssetSymbol: string;
74
+ toAssetChainName: string;
75
+ fromAddress: string;
76
+ toAddress: string;
77
+ fromAmount: string;
78
+ toAmount: string;
79
+ slippage: number;
80
+ gasFeeUsd: string | null;
81
+ otherFeesUsd: string | null;
82
+ status: 'in_progress' | 'completed' | 'failed';
83
+ executedAt: string;
84
+ completedAt: string | null;
85
+ transactionId: string | null;
86
+ transactionHash: string | null;
87
+ explorerLink: string | null;
88
+ };
89
+ /**
90
+ * Response from get swaps endpoint
91
+ */
92
+ export declare type GetSwapsResponse = {
93
+ swaps: SwapTransaction[];
94
+ pagination: PaginationInterface;
95
+ };
@@ -94,6 +94,7 @@ export declare type BaseTransactionRequest = {
94
94
  prfValue?: Uint8Array;
95
95
  clientSalt?: string;
96
96
  memo?: string;
97
+ transactionType?: TransactionType;
97
98
  };
98
99
  export declare type TransferRequest = BaseTransactionRequest & {
99
100
  originAddress: string;
@@ -50,10 +50,6 @@ export declare type TokenBalanceRequest = {
50
50
  };
51
51
  export declare type TokenBalance = {
52
52
  address: string;
53
- configId: string;
54
- /**
55
- * @deprecated Use configId instead.
56
- */
57
53
  assetConfigId: string;
58
54
  assetSymbol: string;
59
55
  balance: string;
@@ -136,6 +132,8 @@ export declare type QueryWalletRequest = {
136
132
  walletId: string;
137
133
  queryOptions?: BasicQueryOptions & {
138
134
  priceConversionCurrency?: string;
135
+ supportsSwaps?: boolean;
136
+ chainName?: BlockchainName;
139
137
  };
140
138
  };
141
139
  export declare type WalletAssetsResponse = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wallaby-cash",
3
- "version": "2.3.0-alpha.2",
3
+ "version": "2.3.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:WALLABY-WaaS/wallaby-sdk-js.git"
@@ -40,6 +40,7 @@
40
40
  "test:coverage": "NODE_ENV=test npm run test --coverage",
41
41
  "test:watch": "NODE_ENV=test jest --watch",
42
42
  "lint": "eslint .",
43
+ "lint:fix": "eslint . --fix",
43
44
  "typecheck": "tsc --noEmit",
44
45
  "audit-ci": "npx audit-ci@^7 --config audit-ci.jsonc",
45
46
  "docs:serve": "docsify serve -p 3100 ./docsify",
@@ -67,12 +68,7 @@
67
68
  "@rollup/plugin-replace": "^6.0.3",
68
69
  "@rollup/plugin-terser": "^0.4.4",
69
70
  "@rollup/plugin-typescript": "^11.1.6",
70
- "@semantic-release/changelog": "^6.0.3",
71
- "@semantic-release/commit-analyzer": "^9.0.2",
72
- "@semantic-release/git": "^10.0.1",
73
- "@semantic-release/github": "^8.0.7",
74
- "@semantic-release/npm": "^12.0.0",
75
- "@semantic-release/release-notes-generator": "^11.0.1",
71
+ "@simplewebauthn/browser": "^13.2.2",
76
72
  "@size-limit/preset-small-lib": "^11.2.0",
77
73
  "@types/crypto-js": "^4.2.2",
78
74
  "@types/jest": "^29.5.0",
@@ -90,12 +86,12 @@
90
86
  "nock": "^13.5.6",
91
87
  "nyc": "^17.1.0",
92
88
  "prettier": "^3.3.3",
89
+ "react-native-passkey": "^3.3.2",
93
90
  "rimraf": "^5.0.7",
94
91
  "rollup": "^4.18.0",
95
92
  "rollup-plugin-copy": "^3.5.0",
96
93
  "rollup-plugin-filesize": "^10.0.0",
97
94
  "rollup-plugin-polyfill-node": "^0.13.0",
98
- "semantic-release": "^24.2.5",
99
95
  "size-limit": "^8.2.4",
100
96
  "swagger-typescript-api": "^13.2.10",
101
97
  "ts-jest": "^29.2.5",
@@ -105,19 +101,34 @@
105
101
  "underscore": "^1.13.7"
106
102
  },
107
103
  "dependencies": {
108
- "@simplewebauthn/browser": "^13.1.0",
109
- "axios": "^1.7.7",
110
104
  "crypto-js": "4.2.0",
111
105
  "ethereum-cryptography": "^3.0.0",
112
106
  "js-base64": "^3.7.7",
113
107
  "jwt-decode": "^4.0.0",
114
- "lodash": "^4.17.21",
108
+ "lodash": "^4.17.23",
115
109
  "loglevel": "^1.9.2",
116
110
  "loglevel-plugin-prefix": "^0.8.4",
117
- "react-native-passkey": "^3.1.0",
118
111
  "uuid": "^10.0.0"
119
112
  },
113
+ "peerDependencies": {
114
+ "@simplewebauthn/browser": "^13.1.0",
115
+ "react-native-passkey": "^3.1.0"
116
+ },
117
+ "peerDependenciesMeta": {
118
+ "@simplewebauthn/browser": {
119
+ "optional": true
120
+ },
121
+ "react-native-passkey": {
122
+ "optional": true
123
+ }
124
+ },
120
125
  "overrides": {
126
+ "markdown-it": "^14.1.1",
127
+ "diff": "^5.2.2",
128
+ "tar": "^7.5.8",
129
+ "lodash": "^4.17.23",
130
+ "lodash-es": "^4.17.23",
131
+ "undici": "^7.19.0",
121
132
  "js-yaml": "^4.1.1",
122
133
  "pbkdf2": "^3.1.3",
123
134
  "esbuild": "^0.25.0",