@compass-labs/widgets 0.1.42 → 0.1.44

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.
@@ -0,0 +1,346 @@
1
+ import * as _compass_labs_api_sdk_models_components from '@compass-labs/api-sdk/models/components';
2
+ import { CompassApiSDK } from '@compass-labs/api-sdk';
3
+ import { C as CompassHandlerConfig } from './types-BOSq6TbU.mjs';
4
+
5
+ declare class CompassServiceError extends Error {
6
+ statusCode: number;
7
+ constructor(message: string, statusCode: number);
8
+ }
9
+ declare class CompassCoreService {
10
+ protected client: CompassApiSDK;
11
+ protected config: CompassHandlerConfig;
12
+ constructor(config: CompassHandlerConfig);
13
+ earnAccountCheck(params: {
14
+ owner?: string;
15
+ chain?: string;
16
+ }): Promise<{
17
+ earnAccountAddress: string;
18
+ isDeployed: boolean;
19
+ needsCreation: boolean;
20
+ }>;
21
+ earnAccountBalances(params: {
22
+ owner?: string;
23
+ chain?: string;
24
+ }): Promise<{
25
+ earnAccountAddress: any;
26
+ balances: Record<string, {
27
+ balance: string;
28
+ usdValue: string;
29
+ }>;
30
+ totalUsdValue: any;
31
+ }>;
32
+ createAccount(body: {
33
+ owner: string;
34
+ chain?: string;
35
+ }): Promise<{
36
+ earnAccountAddress: string;
37
+ success: boolean;
38
+ alreadyExists: boolean;
39
+ txHash?: undefined;
40
+ } | {
41
+ earnAccountAddress: string;
42
+ txHash: `0x${string}`;
43
+ success: boolean;
44
+ alreadyExists?: undefined;
45
+ }>;
46
+ managePrepare(body: {
47
+ amount: string;
48
+ token: string;
49
+ owner: string;
50
+ chain: string;
51
+ venueType: 'VAULT' | 'AAVE' | 'PENDLE_PT';
52
+ vaultAddress?: string;
53
+ marketAddress?: string;
54
+ maxSlippagePercent?: number;
55
+ }, action: 'DEPOSIT' | 'WITHDRAW'): Promise<{
56
+ eip712: any;
57
+ normalizedTypes: {
58
+ EIP712Domain: any;
59
+ SafeTx: any;
60
+ };
61
+ domain: any;
62
+ message: any;
63
+ }>;
64
+ execute(body: {
65
+ owner: string;
66
+ eip712: any;
67
+ signature: string;
68
+ chain: string;
69
+ }): Promise<{
70
+ txHash: `0x${string}`;
71
+ success: boolean;
72
+ }>;
73
+ transferApprove(body: {
74
+ owner: string;
75
+ chain?: string;
76
+ token: string;
77
+ }): Promise<{
78
+ approved: boolean;
79
+ message: string;
80
+ eip712?: undefined;
81
+ normalizedTypes?: undefined;
82
+ domain?: undefined;
83
+ transaction?: undefined;
84
+ requiresTransaction?: undefined;
85
+ } | {
86
+ approved: boolean;
87
+ eip712: any;
88
+ normalizedTypes: {
89
+ EIP712Domain: any;
90
+ Permit: any;
91
+ };
92
+ domain: any;
93
+ message: any;
94
+ transaction?: undefined;
95
+ requiresTransaction?: undefined;
96
+ } | {
97
+ approved: boolean;
98
+ transaction: any;
99
+ requiresTransaction: boolean;
100
+ message?: undefined;
101
+ eip712?: undefined;
102
+ normalizedTypes?: undefined;
103
+ domain?: undefined;
104
+ }>;
105
+ transferPrepare(body: {
106
+ owner: string;
107
+ chain?: string;
108
+ token: string;
109
+ amount: string;
110
+ action: 'DEPOSIT' | 'WITHDRAW';
111
+ product?: 'earn' | 'credit';
112
+ }): Promise<{
113
+ eip712: any;
114
+ normalizedTypes: Record<string, any>;
115
+ domain: any;
116
+ message: any;
117
+ primaryType: any;
118
+ }>;
119
+ transferExecute(body: {
120
+ owner: string;
121
+ chain?: string;
122
+ eip712: any;
123
+ signature: string;
124
+ product?: 'earn' | 'credit';
125
+ }): Promise<{
126
+ txHash: `0x${string}`;
127
+ success: boolean;
128
+ }>;
129
+ approvalExecute(body: {
130
+ owner: string;
131
+ chain?: string;
132
+ transaction: any;
133
+ }): Promise<{
134
+ txHash: `0x${string}`;
135
+ status: string;
136
+ }>;
137
+ swapQuote(params: {
138
+ owner?: string;
139
+ chain?: string;
140
+ tokenIn?: string;
141
+ tokenOut?: string;
142
+ amountIn?: string;
143
+ }): Promise<{
144
+ tokenIn: string;
145
+ tokenOut: string;
146
+ amountIn: string;
147
+ estimatedAmountOut: any;
148
+ }>;
149
+ swapPrepare(body: {
150
+ owner: string;
151
+ chain?: string;
152
+ tokenIn: string;
153
+ tokenOut: string;
154
+ amountIn: string;
155
+ slippage?: number;
156
+ }): Promise<{
157
+ eip712: any;
158
+ normalizedTypes: {
159
+ EIP712Domain: any;
160
+ SafeTx: any;
161
+ };
162
+ domain: any;
163
+ message: any;
164
+ estimatedAmountOut: any;
165
+ }>;
166
+ swapExecute(body: {
167
+ owner: string;
168
+ chain?: string;
169
+ eip712: any;
170
+ signature: string;
171
+ }): Promise<{
172
+ txHash: `0x${string}`;
173
+ success: boolean;
174
+ }>;
175
+ tokenBalance(params: {
176
+ chain?: string;
177
+ token?: string;
178
+ address?: string;
179
+ }): Promise<{
180
+ token: string;
181
+ address: string;
182
+ balance: any;
183
+ balanceRaw: any;
184
+ }>;
185
+ tokenPrices(params: Record<string, string>): Promise<{
186
+ prices: Record<string, number>;
187
+ }>;
188
+ bundlePrepare(body: {
189
+ owner: string;
190
+ chain?: string;
191
+ actions: Array<{
192
+ actionType: string;
193
+ [key: string]: any;
194
+ }>;
195
+ }): Promise<{
196
+ eip712: any;
197
+ normalizedTypes: {
198
+ EIP712Domain: any;
199
+ SafeTx: any;
200
+ };
201
+ domain: any;
202
+ message: any;
203
+ actionsCount: any;
204
+ }>;
205
+ bundleExecute(body: {
206
+ owner: string;
207
+ chain?: string;
208
+ eip712: any;
209
+ signature: string;
210
+ product?: 'earn' | 'credit';
211
+ }): Promise<{
212
+ txHash: `0x${string}`;
213
+ success: boolean;
214
+ }>;
215
+ vaults(params: {
216
+ chain?: string;
217
+ orderBy?: string;
218
+ direction?: string;
219
+ limit?: string;
220
+ assetSymbol?: string;
221
+ minTvlUsd?: string;
222
+ }): Promise<_compass_labs_api_sdk_models_components.VaultsResponse>;
223
+ aaveMarkets(params: {
224
+ chain?: string;
225
+ }): Promise<_compass_labs_api_sdk_models_components.ListAaveMarketsResponse>;
226
+ pendleMarkets(params: {
227
+ chain?: string;
228
+ orderBy?: string;
229
+ direction?: string;
230
+ limit?: string;
231
+ underlyingSymbol?: string;
232
+ minTvlUsd?: string;
233
+ }): Promise<_compass_labs_api_sdk_models_components.PendleMarketsResponse>;
234
+ positions(params: {
235
+ chain?: string;
236
+ owner?: string;
237
+ }): Promise<{
238
+ positions: any[];
239
+ }>;
240
+ txReceipt(params: Record<string, string>): Promise<{
241
+ status: "success" | "reverted";
242
+ blockNumber: string;
243
+ } | {
244
+ status: string;
245
+ blockNumber?: undefined;
246
+ }>;
247
+ rebalancePreview(body: {
248
+ owner: string;
249
+ chain?: string;
250
+ targets: Array<{
251
+ venueType: 'VAULT' | 'AAVE' | 'PENDLE_PT';
252
+ venueAddress: string;
253
+ targetPercent: number;
254
+ token?: string;
255
+ originalPercent?: number;
256
+ }>;
257
+ slippage?: number;
258
+ }): Promise<{
259
+ actions: never[];
260
+ actionsCount: number;
261
+ warnings: string[];
262
+ eip712?: undefined;
263
+ normalizedTypes?: undefined;
264
+ domain?: undefined;
265
+ message?: undefined;
266
+ } | {
267
+ eip712: any;
268
+ normalizedTypes: {
269
+ EIP712Domain: any;
270
+ SafeTx: any;
271
+ };
272
+ domain: any;
273
+ message: any;
274
+ actions: any[];
275
+ actionsCount: number;
276
+ warnings: string[];
277
+ }>;
278
+ creditAccountCheck(params: {
279
+ owner?: string;
280
+ chain?: string;
281
+ }): Promise<{
282
+ creditAccountAddress: string;
283
+ isDeployed: boolean;
284
+ needsCreation: boolean;
285
+ }>;
286
+ creditCreateAccount(body: {
287
+ owner: string;
288
+ chain?: string;
289
+ }): Promise<{
290
+ creditAccountAddress: string;
291
+ success: boolean;
292
+ alreadyExists: boolean;
293
+ txHash?: undefined;
294
+ } | {
295
+ creditAccountAddress: string;
296
+ txHash: `0x${string}`;
297
+ success: boolean;
298
+ alreadyExists?: undefined;
299
+ }>;
300
+ creditPositions(params: {
301
+ owner?: string;
302
+ chain?: string;
303
+ }): Promise<_compass_labs_api_sdk_models_components.CreditPositionsResponse>;
304
+ creditBalances(params: {
305
+ owner?: string;
306
+ chain?: string;
307
+ }): Promise<any[]>;
308
+ creditBundlePrepare(body: {
309
+ owner: string;
310
+ chain?: string;
311
+ actions: Array<Record<string, any>>;
312
+ }): Promise<{
313
+ eip712: any;
314
+ normalizedTypes: {
315
+ EIP712Domain: any;
316
+ SafeTx: any;
317
+ };
318
+ domain: any;
319
+ message: any;
320
+ actionsCount: any;
321
+ }>;
322
+ creditTransfer(body: {
323
+ owner: string;
324
+ chain?: string;
325
+ token: string;
326
+ amount: string;
327
+ }): Promise<{
328
+ eip712: any;
329
+ normalizedTypes: Record<string, any>;
330
+ domain: any;
331
+ message: any;
332
+ primaryType: any;
333
+ }>;
334
+ creditExecute(body: {
335
+ owner: string;
336
+ eip712: any;
337
+ signature: string;
338
+ chain?: string;
339
+ creditAccountAddress: string;
340
+ }): Promise<{
341
+ txHash: `0x${string}`;
342
+ success: boolean;
343
+ }>;
344
+ }
345
+
346
+ export { CompassCoreService as C, CompassServiceError as a };
@@ -0,0 +1,346 @@
1
+ import * as _compass_labs_api_sdk_models_components from '@compass-labs/api-sdk/models/components';
2
+ import { CompassApiSDK } from '@compass-labs/api-sdk';
3
+ import { C as CompassHandlerConfig } from './types-BOSq6TbU.js';
4
+
5
+ declare class CompassServiceError extends Error {
6
+ statusCode: number;
7
+ constructor(message: string, statusCode: number);
8
+ }
9
+ declare class CompassCoreService {
10
+ protected client: CompassApiSDK;
11
+ protected config: CompassHandlerConfig;
12
+ constructor(config: CompassHandlerConfig);
13
+ earnAccountCheck(params: {
14
+ owner?: string;
15
+ chain?: string;
16
+ }): Promise<{
17
+ earnAccountAddress: string;
18
+ isDeployed: boolean;
19
+ needsCreation: boolean;
20
+ }>;
21
+ earnAccountBalances(params: {
22
+ owner?: string;
23
+ chain?: string;
24
+ }): Promise<{
25
+ earnAccountAddress: any;
26
+ balances: Record<string, {
27
+ balance: string;
28
+ usdValue: string;
29
+ }>;
30
+ totalUsdValue: any;
31
+ }>;
32
+ createAccount(body: {
33
+ owner: string;
34
+ chain?: string;
35
+ }): Promise<{
36
+ earnAccountAddress: string;
37
+ success: boolean;
38
+ alreadyExists: boolean;
39
+ txHash?: undefined;
40
+ } | {
41
+ earnAccountAddress: string;
42
+ txHash: `0x${string}`;
43
+ success: boolean;
44
+ alreadyExists?: undefined;
45
+ }>;
46
+ managePrepare(body: {
47
+ amount: string;
48
+ token: string;
49
+ owner: string;
50
+ chain: string;
51
+ venueType: 'VAULT' | 'AAVE' | 'PENDLE_PT';
52
+ vaultAddress?: string;
53
+ marketAddress?: string;
54
+ maxSlippagePercent?: number;
55
+ }, action: 'DEPOSIT' | 'WITHDRAW'): Promise<{
56
+ eip712: any;
57
+ normalizedTypes: {
58
+ EIP712Domain: any;
59
+ SafeTx: any;
60
+ };
61
+ domain: any;
62
+ message: any;
63
+ }>;
64
+ execute(body: {
65
+ owner: string;
66
+ eip712: any;
67
+ signature: string;
68
+ chain: string;
69
+ }): Promise<{
70
+ txHash: `0x${string}`;
71
+ success: boolean;
72
+ }>;
73
+ transferApprove(body: {
74
+ owner: string;
75
+ chain?: string;
76
+ token: string;
77
+ }): Promise<{
78
+ approved: boolean;
79
+ message: string;
80
+ eip712?: undefined;
81
+ normalizedTypes?: undefined;
82
+ domain?: undefined;
83
+ transaction?: undefined;
84
+ requiresTransaction?: undefined;
85
+ } | {
86
+ approved: boolean;
87
+ eip712: any;
88
+ normalizedTypes: {
89
+ EIP712Domain: any;
90
+ Permit: any;
91
+ };
92
+ domain: any;
93
+ message: any;
94
+ transaction?: undefined;
95
+ requiresTransaction?: undefined;
96
+ } | {
97
+ approved: boolean;
98
+ transaction: any;
99
+ requiresTransaction: boolean;
100
+ message?: undefined;
101
+ eip712?: undefined;
102
+ normalizedTypes?: undefined;
103
+ domain?: undefined;
104
+ }>;
105
+ transferPrepare(body: {
106
+ owner: string;
107
+ chain?: string;
108
+ token: string;
109
+ amount: string;
110
+ action: 'DEPOSIT' | 'WITHDRAW';
111
+ product?: 'earn' | 'credit';
112
+ }): Promise<{
113
+ eip712: any;
114
+ normalizedTypes: Record<string, any>;
115
+ domain: any;
116
+ message: any;
117
+ primaryType: any;
118
+ }>;
119
+ transferExecute(body: {
120
+ owner: string;
121
+ chain?: string;
122
+ eip712: any;
123
+ signature: string;
124
+ product?: 'earn' | 'credit';
125
+ }): Promise<{
126
+ txHash: `0x${string}`;
127
+ success: boolean;
128
+ }>;
129
+ approvalExecute(body: {
130
+ owner: string;
131
+ chain?: string;
132
+ transaction: any;
133
+ }): Promise<{
134
+ txHash: `0x${string}`;
135
+ status: string;
136
+ }>;
137
+ swapQuote(params: {
138
+ owner?: string;
139
+ chain?: string;
140
+ tokenIn?: string;
141
+ tokenOut?: string;
142
+ amountIn?: string;
143
+ }): Promise<{
144
+ tokenIn: string;
145
+ tokenOut: string;
146
+ amountIn: string;
147
+ estimatedAmountOut: any;
148
+ }>;
149
+ swapPrepare(body: {
150
+ owner: string;
151
+ chain?: string;
152
+ tokenIn: string;
153
+ tokenOut: string;
154
+ amountIn: string;
155
+ slippage?: number;
156
+ }): Promise<{
157
+ eip712: any;
158
+ normalizedTypes: {
159
+ EIP712Domain: any;
160
+ SafeTx: any;
161
+ };
162
+ domain: any;
163
+ message: any;
164
+ estimatedAmountOut: any;
165
+ }>;
166
+ swapExecute(body: {
167
+ owner: string;
168
+ chain?: string;
169
+ eip712: any;
170
+ signature: string;
171
+ }): Promise<{
172
+ txHash: `0x${string}`;
173
+ success: boolean;
174
+ }>;
175
+ tokenBalance(params: {
176
+ chain?: string;
177
+ token?: string;
178
+ address?: string;
179
+ }): Promise<{
180
+ token: string;
181
+ address: string;
182
+ balance: any;
183
+ balanceRaw: any;
184
+ }>;
185
+ tokenPrices(params: Record<string, string>): Promise<{
186
+ prices: Record<string, number>;
187
+ }>;
188
+ bundlePrepare(body: {
189
+ owner: string;
190
+ chain?: string;
191
+ actions: Array<{
192
+ actionType: string;
193
+ [key: string]: any;
194
+ }>;
195
+ }): Promise<{
196
+ eip712: any;
197
+ normalizedTypes: {
198
+ EIP712Domain: any;
199
+ SafeTx: any;
200
+ };
201
+ domain: any;
202
+ message: any;
203
+ actionsCount: any;
204
+ }>;
205
+ bundleExecute(body: {
206
+ owner: string;
207
+ chain?: string;
208
+ eip712: any;
209
+ signature: string;
210
+ product?: 'earn' | 'credit';
211
+ }): Promise<{
212
+ txHash: `0x${string}`;
213
+ success: boolean;
214
+ }>;
215
+ vaults(params: {
216
+ chain?: string;
217
+ orderBy?: string;
218
+ direction?: string;
219
+ limit?: string;
220
+ assetSymbol?: string;
221
+ minTvlUsd?: string;
222
+ }): Promise<_compass_labs_api_sdk_models_components.VaultsResponse>;
223
+ aaveMarkets(params: {
224
+ chain?: string;
225
+ }): Promise<_compass_labs_api_sdk_models_components.ListAaveMarketsResponse>;
226
+ pendleMarkets(params: {
227
+ chain?: string;
228
+ orderBy?: string;
229
+ direction?: string;
230
+ limit?: string;
231
+ underlyingSymbol?: string;
232
+ minTvlUsd?: string;
233
+ }): Promise<_compass_labs_api_sdk_models_components.PendleMarketsResponse>;
234
+ positions(params: {
235
+ chain?: string;
236
+ owner?: string;
237
+ }): Promise<{
238
+ positions: any[];
239
+ }>;
240
+ txReceipt(params: Record<string, string>): Promise<{
241
+ status: "success" | "reverted";
242
+ blockNumber: string;
243
+ } | {
244
+ status: string;
245
+ blockNumber?: undefined;
246
+ }>;
247
+ rebalancePreview(body: {
248
+ owner: string;
249
+ chain?: string;
250
+ targets: Array<{
251
+ venueType: 'VAULT' | 'AAVE' | 'PENDLE_PT';
252
+ venueAddress: string;
253
+ targetPercent: number;
254
+ token?: string;
255
+ originalPercent?: number;
256
+ }>;
257
+ slippage?: number;
258
+ }): Promise<{
259
+ actions: never[];
260
+ actionsCount: number;
261
+ warnings: string[];
262
+ eip712?: undefined;
263
+ normalizedTypes?: undefined;
264
+ domain?: undefined;
265
+ message?: undefined;
266
+ } | {
267
+ eip712: any;
268
+ normalizedTypes: {
269
+ EIP712Domain: any;
270
+ SafeTx: any;
271
+ };
272
+ domain: any;
273
+ message: any;
274
+ actions: any[];
275
+ actionsCount: number;
276
+ warnings: string[];
277
+ }>;
278
+ creditAccountCheck(params: {
279
+ owner?: string;
280
+ chain?: string;
281
+ }): Promise<{
282
+ creditAccountAddress: string;
283
+ isDeployed: boolean;
284
+ needsCreation: boolean;
285
+ }>;
286
+ creditCreateAccount(body: {
287
+ owner: string;
288
+ chain?: string;
289
+ }): Promise<{
290
+ creditAccountAddress: string;
291
+ success: boolean;
292
+ alreadyExists: boolean;
293
+ txHash?: undefined;
294
+ } | {
295
+ creditAccountAddress: string;
296
+ txHash: `0x${string}`;
297
+ success: boolean;
298
+ alreadyExists?: undefined;
299
+ }>;
300
+ creditPositions(params: {
301
+ owner?: string;
302
+ chain?: string;
303
+ }): Promise<_compass_labs_api_sdk_models_components.CreditPositionsResponse>;
304
+ creditBalances(params: {
305
+ owner?: string;
306
+ chain?: string;
307
+ }): Promise<any[]>;
308
+ creditBundlePrepare(body: {
309
+ owner: string;
310
+ chain?: string;
311
+ actions: Array<Record<string, any>>;
312
+ }): Promise<{
313
+ eip712: any;
314
+ normalizedTypes: {
315
+ EIP712Domain: any;
316
+ SafeTx: any;
317
+ };
318
+ domain: any;
319
+ message: any;
320
+ actionsCount: any;
321
+ }>;
322
+ creditTransfer(body: {
323
+ owner: string;
324
+ chain?: string;
325
+ token: string;
326
+ amount: string;
327
+ }): Promise<{
328
+ eip712: any;
329
+ normalizedTypes: Record<string, any>;
330
+ domain: any;
331
+ message: any;
332
+ primaryType: any;
333
+ }>;
334
+ creditExecute(body: {
335
+ owner: string;
336
+ eip712: any;
337
+ signature: string;
338
+ chain?: string;
339
+ creditAccountAddress: string;
340
+ }): Promise<{
341
+ txHash: `0x${string}`;
342
+ success: boolean;
343
+ }>;
344
+ }
345
+
346
+ export { CompassCoreService as C, CompassServiceError as a };
@@ -0,0 +1,18 @@
1
+ export { a as CHAIN_MAP, b as CREDIT_TOKENS, C as CompassHandlerConfig } from '../../types-BOSq6TbU.mjs';
2
+ export { C as CompassCoreService, a as CompassServiceError } from '../../compass-service-CpGcD-yK.mjs';
3
+ import 'viem';
4
+ import '@compass-labs/api-sdk/models/components';
5
+ import '@compass-labs/api-sdk';
6
+
7
+ /**
8
+ * Extracts a user-friendly error message from SDK/API errors.
9
+ * SDK errors contain verbose technical data (Zod dumps, full HTTP bodies) that
10
+ * should never be shown to end-users.
11
+ */
12
+ declare function extractErrorMessage(error: unknown): {
13
+ message: string;
14
+ status: number;
15
+ };
16
+ declare function jsonResponse(data: unknown, status?: number): Response;
17
+
18
+ export { extractErrorMessage, jsonResponse };