wallaby-cash 2.2.8 → 2.2.10
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/helpers/normalize-storage-keys.d.ts +8 -0
- package/dist/index.cjs.js +320 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +320 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +320 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/swap/index.d.ts +36 -0
- package/dist/lib/system/index.d.ts +14 -4
- package/dist/lib/wallet/wallet-data.service.d.ts +2 -0
- package/dist/package.json +8 -9
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/swap.d.ts +24 -0
- package/dist/types/common.d.ts +3 -0
- package/dist/types/error-response-codes.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/swap.d.ts +95 -0
- package/dist/types/wallet.d.ts +2 -0
- package/package.json +8 -9
package/dist/lib/index.d.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Base } from '../../base';
|
|
2
|
+
import { WallabyConfig, SwapQuoteRequest, SwapQuoteResponse, ExecuteSwapRequest, ExecuteSwapResponse, GetSwapsRequest, GetSwapsResponse } from '../../types';
|
|
3
|
+
export declare class Swap extends Base {
|
|
4
|
+
private authService;
|
|
5
|
+
private walletService;
|
|
6
|
+
constructor(config: WallabyConfig);
|
|
7
|
+
/**
|
|
8
|
+
* Gets a swap quote between two assets (from/to), including fees, min output, and slippage limits.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @param {SwapQuoteRequest} request - The swap quote request parameters
|
|
12
|
+
* @returns {Promise<SwapQuoteResponse>} A promise that resolves with the swap quote
|
|
13
|
+
*/
|
|
14
|
+
getQuote({ walletId, fromAsset, toAsset, fromAmount, toAmount }: SwapQuoteRequest): Promise<SwapQuoteResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Executes a swap using a previously generated quote.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @param {ExecuteSwapRequest} request - The execute swap request parameters
|
|
20
|
+
* @returns {Promise<ExecuteSwapResponse>} A promise that resolves with the swap execution response
|
|
21
|
+
*/
|
|
22
|
+
executeSwap({ walletId, quoteId, authenticationOptions }: ExecuteSwapRequest): Promise<ExecuteSwapResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Lists executed swap transactions for a given wallet, with optional date and pagination filters.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @param {GetSwapsRequest} request - The get swaps request parameters
|
|
28
|
+
* @returns {Promise<GetSwapsResponse>} A promise that resolves with the list of swaps
|
|
29
|
+
*/
|
|
30
|
+
getSwaps({ walletId, queryParams }: GetSwapsRequest): Promise<GetSwapsResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Prepares authentication data and encrypted payload for swap requests
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private prepareSwapAuth;
|
|
36
|
+
}
|
|
@@ -5,10 +5,13 @@ export declare class System extends Base {
|
|
|
5
5
|
/**
|
|
6
6
|
* @public
|
|
7
7
|
* Get all supported chains
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {Object} [options] - Optional query parameters
|
|
9
|
+
* @param {boolean} [options.supportSwaps] - When true, include only chains that support swaps
|
|
9
10
|
* @returns {Array<Blockchain>} Array of supported chains
|
|
10
11
|
*/
|
|
11
|
-
getSupportedBlockchains(
|
|
12
|
+
getSupportedBlockchains(options?: {
|
|
13
|
+
supportSwaps?: boolean;
|
|
14
|
+
}): Promise<Array<Blockchain> | undefined>;
|
|
12
15
|
/**
|
|
13
16
|
* Validates the contract address or SUI object ID for a given blockchain.
|
|
14
17
|
*
|
|
@@ -57,10 +60,17 @@ export declare class System extends Base {
|
|
|
57
60
|
/**
|
|
58
61
|
* @public
|
|
59
62
|
* Get all supported assets configuration
|
|
60
|
-
* @param {
|
|
63
|
+
* @param {Object} [options] - Optional query parameters
|
|
64
|
+
* @param {boolean} [options.supportsSwaps] - When true, filter to assets that support swaps
|
|
65
|
+
* @param {string} [options.search] - Search assets by name or symbol (minimum 3 characters)
|
|
66
|
+
* @param {BlockchainName} [options.chainName] - Filter assets by blockchain name
|
|
61
67
|
* @returns {Array<AssetConfig>} Array of supported tokens
|
|
62
68
|
*/
|
|
63
|
-
getSupportedTokens(
|
|
69
|
+
getSupportedTokens(options?: {
|
|
70
|
+
supportsSwaps?: boolean;
|
|
71
|
+
search?: string;
|
|
72
|
+
chainName?: BlockchainName;
|
|
73
|
+
}): Promise<AssetConfig[] | undefined>;
|
|
64
74
|
/**
|
|
65
75
|
* @public
|
|
66
76
|
* @param {string} userId
|
|
@@ -62,6 +62,8 @@ export declare class WalletDataService extends Base {
|
|
|
62
62
|
* Get all assets that exist in a certain wallet, by specifying a wallet ID
|
|
63
63
|
* @param walletId Wallaby's wallet ID
|
|
64
64
|
* @param { BasicQueryOptions } queryOptions Optional query options
|
|
65
|
+
* @param { string } [queryOptions.search] - Search assets by name or symbol (minimum 3 characters)
|
|
66
|
+
* @param { BlockchainName } [queryOptions.chainName] - Filter assets by blockchain name
|
|
65
67
|
* @returns { GetUserAssetsByWalletIdData } Returns all assets belonging in a certain wallet ID
|
|
66
68
|
*/
|
|
67
69
|
getWalletAssets({ walletId, queryOptions }: QueryWalletRequest): Promise<GetUserAssetsByWalletIdData>;
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wallaby-cash",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.10",
|
|
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,6 @@
|
|
|
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",
|
|
76
71
|
"@size-limit/preset-small-lib": "^11.2.0",
|
|
77
72
|
"@types/crypto-js": "^4.2.2",
|
|
78
73
|
"@types/jest": "^29.5.0",
|
|
@@ -95,7 +90,6 @@
|
|
|
95
90
|
"rollup-plugin-copy": "^3.5.0",
|
|
96
91
|
"rollup-plugin-filesize": "^10.0.0",
|
|
97
92
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
98
|
-
"semantic-release": "^24.2.5",
|
|
99
93
|
"size-limit": "^8.2.4",
|
|
100
94
|
"swagger-typescript-api": "^13.2.10",
|
|
101
95
|
"ts-jest": "^29.2.5",
|
|
@@ -111,13 +105,18 @@
|
|
|
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.
|
|
108
|
+
"lodash": "^4.17.23",
|
|
115
109
|
"loglevel": "^1.9.2",
|
|
116
110
|
"loglevel-plugin-prefix": "^0.8.4",
|
|
117
111
|
"react-native-passkey": "^3.1.0",
|
|
118
112
|
"uuid": "^10.0.0"
|
|
119
113
|
},
|
|
120
114
|
"overrides": {
|
|
115
|
+
"diff": "^5.2.2",
|
|
116
|
+
"tar": "^7.5.7",
|
|
117
|
+
"lodash": "^4.17.23",
|
|
118
|
+
"lodash-es": "^4.17.23",
|
|
119
|
+
"undici": "^7.19.0",
|
|
121
120
|
"js-yaml": "^4.1.1",
|
|
122
121
|
"pbkdf2": "^3.1.3",
|
|
123
122
|
"esbuild": "^0.25.0",
|
package/dist/routes/index.d.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RequestMethod } from '../types';
|
|
2
|
+
export declare const SwapRoutes: {
|
|
3
|
+
getQuote: {
|
|
4
|
+
fullPath: ({ walletId }: {
|
|
5
|
+
walletId: string;
|
|
6
|
+
}) => string;
|
|
7
|
+
method: RequestMethod;
|
|
8
|
+
requiresAccessToken: boolean;
|
|
9
|
+
};
|
|
10
|
+
executeSwap: {
|
|
11
|
+
fullPath: ({ walletId }: {
|
|
12
|
+
walletId: string;
|
|
13
|
+
}) => string;
|
|
14
|
+
method: RequestMethod;
|
|
15
|
+
requiresAccessToken: boolean;
|
|
16
|
+
};
|
|
17
|
+
getSwaps: {
|
|
18
|
+
fullPath: ({ walletId }: {
|
|
19
|
+
walletId: string;
|
|
20
|
+
}) => string;
|
|
21
|
+
method: RequestMethod;
|
|
22
|
+
requiresAccessToken: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
package/dist/types/common.d.ts
CHANGED
|
@@ -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",
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
+
};
|
package/dist/types/wallet.d.ts
CHANGED
|
@@ -136,6 +136,8 @@ export declare type QueryWalletRequest = {
|
|
|
136
136
|
walletId: string;
|
|
137
137
|
queryOptions?: BasicQueryOptions & {
|
|
138
138
|
priceConversionCurrency?: string;
|
|
139
|
+
supportsSwaps?: boolean;
|
|
140
|
+
chainName?: BlockchainName;
|
|
139
141
|
};
|
|
140
142
|
};
|
|
141
143
|
export declare type WalletAssetsResponse = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wallaby-cash",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.10",
|
|
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,6 @@
|
|
|
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",
|
|
76
71
|
"@size-limit/preset-small-lib": "^11.2.0",
|
|
77
72
|
"@types/crypto-js": "^4.2.2",
|
|
78
73
|
"@types/jest": "^29.5.0",
|
|
@@ -95,7 +90,6 @@
|
|
|
95
90
|
"rollup-plugin-copy": "^3.5.0",
|
|
96
91
|
"rollup-plugin-filesize": "^10.0.0",
|
|
97
92
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
98
|
-
"semantic-release": "^24.2.5",
|
|
99
93
|
"size-limit": "^8.2.4",
|
|
100
94
|
"swagger-typescript-api": "^13.2.10",
|
|
101
95
|
"ts-jest": "^29.2.5",
|
|
@@ -111,13 +105,18 @@
|
|
|
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.
|
|
108
|
+
"lodash": "^4.17.23",
|
|
115
109
|
"loglevel": "^1.9.2",
|
|
116
110
|
"loglevel-plugin-prefix": "^0.8.4",
|
|
117
111
|
"react-native-passkey": "^3.1.0",
|
|
118
112
|
"uuid": "^10.0.0"
|
|
119
113
|
},
|
|
120
114
|
"overrides": {
|
|
115
|
+
"diff": "^5.2.2",
|
|
116
|
+
"tar": "^7.5.7",
|
|
117
|
+
"lodash": "^4.17.23",
|
|
118
|
+
"lodash-es": "^4.17.23",
|
|
119
|
+
"undici": "^7.19.0",
|
|
121
120
|
"js-yaml": "^4.1.1",
|
|
122
121
|
"pbkdf2": "^3.1.3",
|
|
123
122
|
"esbuild": "^0.25.0",
|