@bitflowlabs/core-sdk 2.3.0 → 2.3.2-beta.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.
- package/dist/src/config.d.ts +1 -1
- package/dist/src/config.js +12 -10
- package/dist/src/config.js.map +1 -1
- package/dist/src/helpers/callReadOnlyHelper.js +18 -17
- package/dist/src/helpers/callReadOnlyHelper.js.map +1 -1
- package/package.json +2 -3
- package/src/BitflowSDK.ts +0 -1244
- package/src/config.ts +0 -41
- package/src/helpers/callGetSwapParams.ts +0 -122
- package/src/helpers/callReadOnlyHelper.ts +0 -482
- package/src/helpers/callSwapHelper.ts +0 -67
- package/src/helpers/constructFunctionArgs.ts +0 -24
- package/src/helpers/convertValuesHelper.ts +0 -220
- package/src/helpers/fetchContractInterfaceHelper.ts +0 -27
- package/src/helpers/fetchDataHelper.ts +0 -88
- package/src/helpers/fetchPossibleSwap.ts +0 -39
- package/src/helpers/getContractInterfaceAndFunction.ts +0 -20
- package/src/helpers/getFunctionArgs.ts +0 -12
- package/src/helpers/getTokenDecimalsHelper.ts +0 -33
- package/src/helpers/getTokenNameHelper.ts +0 -26
- package/src/helpers/handleResultHelper.ts +0 -84
- package/src/helpers/newPostConditionsHelper.ts +0 -172
- package/src/helpers/postConditionsHelper.ts +0 -298
- package/src/index.ts +0 -3
- package/src/keeper/keeperAPI.ts +0 -365
- package/src/keeper/types.ts +0 -310
- package/src/test/testMethods.ts +0 -246
- package/src/types.ts +0 -168
package/src/keeper/keeperAPI.ts
DELETED
|
@@ -1,365 +0,0 @@
|
|
|
1
|
-
import { configs } from "../config";
|
|
2
|
-
import {
|
|
3
|
-
ActionFunctionArgs,
|
|
4
|
-
CancelGroupOrderResponse,
|
|
5
|
-
CancelOrderResponse,
|
|
6
|
-
CreateGroupOrderParams,
|
|
7
|
-
CreateGroupOrderResponse,
|
|
8
|
-
CreateOrderParams,
|
|
9
|
-
CreateOrderResponse,
|
|
10
|
-
GetGroupOrderResponse,
|
|
11
|
-
GetKeeperContractParams,
|
|
12
|
-
GetKeeperContractResponse,
|
|
13
|
-
GetOrderResponse,
|
|
14
|
-
GetQuoteParams,
|
|
15
|
-
GetQuoteResponse,
|
|
16
|
-
GetUserResponse,
|
|
17
|
-
KeeperContract,
|
|
18
|
-
KeeperOrder,
|
|
19
|
-
} from "./types";
|
|
20
|
-
|
|
21
|
-
const getKeeperHeaders = () => ({
|
|
22
|
-
Accept: "application/json",
|
|
23
|
-
"Content-Type": "application/json",
|
|
24
|
-
"x-api-key": configs.KEEPER_API_KEY,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export async function getOrCreateKeeperContractAPI(
|
|
28
|
-
params: GetKeeperContractParams
|
|
29
|
-
): Promise<GetKeeperContractResponse> {
|
|
30
|
-
try {
|
|
31
|
-
const queryParams = new URLSearchParams({
|
|
32
|
-
stacksAddress: params.stacksAddress,
|
|
33
|
-
keeperType: params.keeperType,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
if (params.bitcoinAddress) {
|
|
37
|
-
queryParams.append("bitcoinAddress", params.bitcoinAddress);
|
|
38
|
-
}
|
|
39
|
-
if (typeof params.deployContract === "boolean") {
|
|
40
|
-
queryParams.append("deployContract", params.deployContract.toString());
|
|
41
|
-
}
|
|
42
|
-
if (typeof params.allActionsApproved === "boolean") {
|
|
43
|
-
queryParams.append(
|
|
44
|
-
"allActionsApproved",
|
|
45
|
-
params.allActionsApproved.toString()
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const url = `${
|
|
50
|
-
configs.KEEPER_API_HOST
|
|
51
|
-
}/getOrCreateKeeperContract?${queryParams.toString()}`;
|
|
52
|
-
|
|
53
|
-
const response = await fetch(url, {
|
|
54
|
-
method: "GET",
|
|
55
|
-
headers: getKeeperHeaders(),
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
if (!response.ok) {
|
|
59
|
-
const errorData = await response.json();
|
|
60
|
-
throw new Error(
|
|
61
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const data = await response.json();
|
|
66
|
-
return data as GetKeeperContractResponse;
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error("Error in getOrCreateKeeperContract:", error);
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export async function getOrderAPI(orderId: string): Promise<GetOrderResponse> {
|
|
74
|
-
try {
|
|
75
|
-
const queryParams = new URLSearchParams({
|
|
76
|
-
orderId: orderId,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const url = `${configs.KEEPER_API_HOST}/getOrder?${queryParams.toString()}`;
|
|
80
|
-
|
|
81
|
-
const response = await fetch(url, {
|
|
82
|
-
method: "GET",
|
|
83
|
-
headers: getKeeperHeaders(),
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
if (!response.ok) {
|
|
87
|
-
const errorData = await response.json();
|
|
88
|
-
throw new Error(
|
|
89
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const data = await response.json();
|
|
94
|
-
return data as GetOrderResponse;
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.error("Error in getOrder:", error);
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export async function getUserAPI(
|
|
102
|
-
stacksAddress: string
|
|
103
|
-
): Promise<GetUserResponse> {
|
|
104
|
-
try {
|
|
105
|
-
const queryParams = new URLSearchParams({
|
|
106
|
-
stacksAddress: stacksAddress,
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const url = `${configs.KEEPER_API_HOST}/getUser?${queryParams.toString()}`;
|
|
110
|
-
|
|
111
|
-
const response = await fetch(url, {
|
|
112
|
-
method: "GET",
|
|
113
|
-
headers: getKeeperHeaders(),
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
if (!response.ok) {
|
|
117
|
-
const errorData = await response.json();
|
|
118
|
-
throw new Error(
|
|
119
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const data = await response.json();
|
|
124
|
-
return data as GetUserResponse;
|
|
125
|
-
} catch (error) {
|
|
126
|
-
console.error("Error in getUser:", error);
|
|
127
|
-
throw error;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export async function createOrderAPI(
|
|
132
|
-
params: CreateOrderParams
|
|
133
|
-
): Promise<CreateOrderResponse> {
|
|
134
|
-
try {
|
|
135
|
-
const url = `${configs.KEEPER_API_HOST}/createOrder`;
|
|
136
|
-
|
|
137
|
-
const requestBody = {
|
|
138
|
-
stacksAddress: params.stacksAddress,
|
|
139
|
-
keeperType: params.keeperType,
|
|
140
|
-
contractIdentifier: params.contractIdentifier,
|
|
141
|
-
bitcoinAddress: params.bitcoinAddress || "",
|
|
142
|
-
actionAmount: params.actionAmount || "",
|
|
143
|
-
minReceived: params.minReceived || {
|
|
144
|
-
amount: "",
|
|
145
|
-
autoAdjust: false,
|
|
146
|
-
},
|
|
147
|
-
feeRecipient: params.feeRecipient || "",
|
|
148
|
-
tokenOrder: params.tokenOrder || [],
|
|
149
|
-
actionType: params.actionType,
|
|
150
|
-
bitcoinTxId: params.bitcoinTxId,
|
|
151
|
-
fundingTokens: params.fundingTokens || {},
|
|
152
|
-
actionAggregatorTokens: params.actionAggregatorTokens || undefined,
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const response = await fetch(url, {
|
|
156
|
-
method: "POST",
|
|
157
|
-
headers: getKeeperHeaders(),
|
|
158
|
-
body: JSON.stringify(requestBody),
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
if (!response.ok) {
|
|
162
|
-
const errorData = await response.json();
|
|
163
|
-
throw new Error(
|
|
164
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const data = await response.json();
|
|
169
|
-
return data as CreateOrderResponse;
|
|
170
|
-
} catch (error) {
|
|
171
|
-
console.error("Error in createOrder:", error);
|
|
172
|
-
throw error;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export async function getQuoteAPI(
|
|
177
|
-
params: GetQuoteParams
|
|
178
|
-
): Promise<GetQuoteResponse> {
|
|
179
|
-
try {
|
|
180
|
-
const queryParams = new URLSearchParams();
|
|
181
|
-
|
|
182
|
-
queryParams.append("stacksAddress", params.stacksAddress);
|
|
183
|
-
queryParams.append("actionAmount", params.actionAmount);
|
|
184
|
-
queryParams.append("keeperType", params.keeperType);
|
|
185
|
-
|
|
186
|
-
if (params.actionType) {
|
|
187
|
-
queryParams.append("actionType", params.actionType);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (params.tokenXId && params.tokenYId) {
|
|
191
|
-
queryParams.append("tokenXId", params.tokenXId);
|
|
192
|
-
queryParams.append("tokenYId", params.tokenYId);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (params.minReceived) {
|
|
196
|
-
queryParams.append("minReceived[amount]", params.minReceived.amount);
|
|
197
|
-
queryParams.append(
|
|
198
|
-
"minReceived[autoAdjust]",
|
|
199
|
-
params.minReceived.autoAdjust.toString()
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (params.feeRecipient) {
|
|
204
|
-
queryParams.append("feeRecipient", params.feeRecipient);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (params.bitcoinAddress) {
|
|
208
|
-
queryParams.append("bitcoinAddress", params.bitcoinAddress);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const url = `${configs.KEEPER_API_HOST}/getQuote?${queryParams.toString()}`;
|
|
212
|
-
|
|
213
|
-
const response = await fetch(url, {
|
|
214
|
-
method: "GET",
|
|
215
|
-
headers: getKeeperHeaders(),
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
const responseText = await response.text();
|
|
219
|
-
|
|
220
|
-
if (!response.ok) {
|
|
221
|
-
throw new Error(`Unable to get quote: ${responseText}`);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return JSON.parse(responseText) as GetQuoteResponse;
|
|
225
|
-
} catch (error) {
|
|
226
|
-
console.error("Error in getQuote:", error);
|
|
227
|
-
throw error;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export async function createGroupOrderAPI(
|
|
232
|
-
params: CreateGroupOrderParams
|
|
233
|
-
): Promise<CreateGroupOrderResponse> {
|
|
234
|
-
try {
|
|
235
|
-
const url = `${configs.KEEPER_API_HOST}/createGroupOrder`;
|
|
236
|
-
|
|
237
|
-
const requestBody: any = {
|
|
238
|
-
stacksAddress: params.stacksAddress,
|
|
239
|
-
amountPerOrder: params.amountPerOrder,
|
|
240
|
-
minReceived: params.minReceived,
|
|
241
|
-
numberOfOrders: params.numberOfOrders,
|
|
242
|
-
executionFrequency: params.executionFrequency,
|
|
243
|
-
feeRecipient: params.feeRecipient,
|
|
244
|
-
fundingTokens: params.fundingTokens,
|
|
245
|
-
bitcoinTxId: params.bitcoinTxId,
|
|
246
|
-
stacksTxId: params.stacksTxId,
|
|
247
|
-
keeperType: params.keeperType,
|
|
248
|
-
actionType: params.actionType,
|
|
249
|
-
actionFunctionArgs: params.actionFunctionArgs,
|
|
250
|
-
actionPostConditions: params.actionPostConditions,
|
|
251
|
-
actionAggregatorTokens: params.actionAggregatorTokens,
|
|
252
|
-
bitcoinAddress: params.bitcoinAddress || "",
|
|
253
|
-
nextExecutionAfter: params.nextExecutionAfter?.toISOString(),
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
if (params.priceRange) {
|
|
257
|
-
requestBody.priceRange = params.priceRange;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const response = await fetch(url, {
|
|
261
|
-
method: "POST",
|
|
262
|
-
headers: getKeeperHeaders(),
|
|
263
|
-
body: JSON.stringify(requestBody),
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
if (!response.ok) {
|
|
267
|
-
const errorData = await response.json();
|
|
268
|
-
throw new Error(
|
|
269
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const data = await response.json();
|
|
274
|
-
return data as CreateGroupOrderResponse;
|
|
275
|
-
} catch (error) {
|
|
276
|
-
console.error("Error in createGroupOrder:", error);
|
|
277
|
-
throw error;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
export async function getGroupOrderAPI(
|
|
282
|
-
groupId: string,
|
|
283
|
-
includeOrders: boolean = false
|
|
284
|
-
): Promise<GetGroupOrderResponse> {
|
|
285
|
-
try {
|
|
286
|
-
const queryParams = new URLSearchParams({
|
|
287
|
-
groupId: groupId,
|
|
288
|
-
includeOrders: includeOrders.toString(),
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
const url = `${
|
|
292
|
-
configs.KEEPER_API_HOST
|
|
293
|
-
}/getGroupOrder?${queryParams.toString()}`;
|
|
294
|
-
|
|
295
|
-
const response = await fetch(url, {
|
|
296
|
-
method: "GET",
|
|
297
|
-
headers: getKeeperHeaders(),
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
if (!response.ok) {
|
|
301
|
-
const errorData = await response.json();
|
|
302
|
-
throw new Error(
|
|
303
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const data = await response.json();
|
|
308
|
-
return data as GetGroupOrderResponse;
|
|
309
|
-
} catch (error) {
|
|
310
|
-
console.error("Error in getGroupOrder:", error);
|
|
311
|
-
throw error;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export async function cancelOrderAPI(
|
|
316
|
-
orderId: string
|
|
317
|
-
): Promise<CancelOrderResponse> {
|
|
318
|
-
try {
|
|
319
|
-
const url = `${configs.KEEPER_API_HOST}/cancelOrder`;
|
|
320
|
-
|
|
321
|
-
const response = await fetch(url, {
|
|
322
|
-
method: "POST",
|
|
323
|
-
headers: getKeeperHeaders(),
|
|
324
|
-
body: JSON.stringify({ orderId }),
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
if (!response.ok) {
|
|
328
|
-
const errorData = await response.json();
|
|
329
|
-
throw new Error(
|
|
330
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
return (await response.json()) as CancelOrderResponse;
|
|
335
|
-
} catch (error) {
|
|
336
|
-
console.error("Error in cancelOrder:", error);
|
|
337
|
-
throw error;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
export async function cancelGroupOrderAPI(
|
|
342
|
-
groupId: string
|
|
343
|
-
): Promise<CancelGroupOrderResponse> {
|
|
344
|
-
try {
|
|
345
|
-
const url = `${configs.KEEPER_API_HOST}/cancelGroupOrder`;
|
|
346
|
-
|
|
347
|
-
const response = await fetch(url, {
|
|
348
|
-
method: "POST",
|
|
349
|
-
headers: getKeeperHeaders(),
|
|
350
|
-
body: JSON.stringify({ groupId }),
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
if (!response.ok) {
|
|
354
|
-
const errorData = await response.json();
|
|
355
|
-
throw new Error(
|
|
356
|
-
errorData.error || `HTTP error! status: ${response.status}`
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return (await response.json()) as CancelGroupOrderResponse;
|
|
361
|
-
} catch (error) {
|
|
362
|
-
console.error("Error in cancelGroupOrder:", error);
|
|
363
|
-
throw error;
|
|
364
|
-
}
|
|
365
|
-
}
|
package/src/keeper/types.ts
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
export const ALLOWED_CONTRACTS = new Set([
|
|
2
|
-
"SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.xyk-core-v-1-1",
|
|
3
|
-
"SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.xyk-core-v-1-2",
|
|
4
|
-
"SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.xyk-swap-helper-v-1-2",
|
|
5
|
-
"SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.stableswap-core-v-1-1",
|
|
6
|
-
"SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.stableswap-core-v-1-2",
|
|
7
|
-
"SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.stableswap-swap-helper-v-1-2",
|
|
8
|
-
"SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.router-xyk-stableswap-v-1-1",
|
|
9
|
-
]);
|
|
10
|
-
|
|
11
|
-
export enum ActionType {
|
|
12
|
-
SWAP_XYK_SWAP_HELPER = "SWAP_XYK_SWAP_HELPER",
|
|
13
|
-
SWAP_XYK_STABLESWAP_SWAP_HELPER = "SWAP_XYK_STABLESWAP_SWAP_HELPER",
|
|
14
|
-
SWAP_STABLESWAP_SWAP_HELPER = "SWAP_STABLESWAP_SWAP_HELPER",
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export enum KeeperType {
|
|
18
|
-
SWAP_BTC_TO_STX = "SWAP_BTC_TO_STX",
|
|
19
|
-
SWAP_RUNES_TO_RUNES_BRIDGE_OUT = "SWAP_RUNES_TO_RUNES_BRIDGE_OUT",
|
|
20
|
-
SWAP_BTC_TO_RUNES_BRIDGE_OUT = "SWAP_BTC_TO_RUNES_BRIDGE_OUT",
|
|
21
|
-
SWAP_RUNES_TO_BTC_BRIDGE_OUT = "SWAP_RUNES_TO_BTC_BRIDGE_OUT",
|
|
22
|
-
MULTI_ACTION_V1 = "MULTI_ACTION_V1",
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export enum KeeperTransactionType {
|
|
26
|
-
BITCOIN = "bitcoinTx",
|
|
27
|
-
STACKS = "stacksTx",
|
|
28
|
-
DEPLOY = "deployTx",
|
|
29
|
-
ACTION = "actionTx",
|
|
30
|
-
PONTIS = "pontisTx",
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export enum KeeperContractStatus {
|
|
34
|
-
ContractDeploymentNotStarted = "contractDeploymentNotStarted",
|
|
35
|
-
ContractDeploymentPending = "contractDeploymentPending",
|
|
36
|
-
ContractDeploymentSuccess = "contractDeploymentSuccess",
|
|
37
|
-
ContractDeploymentFailed = "contractDeploymentFailed",
|
|
38
|
-
ContractDeploymentRetry = "contractDeploymentRetry",
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export enum KeeperOrderStatus {
|
|
42
|
-
OrderCreated = "orderCreated",
|
|
43
|
-
OrderComplete = "orderComplete",
|
|
44
|
-
OrderFailed = "orderFailed",
|
|
45
|
-
ContractDeploymentPending = "contractDeploymentPending",
|
|
46
|
-
ContractDeploymentFailed = "contractDeploymentFailed",
|
|
47
|
-
ContractDeploymentRetry = "contractDeploymentRetry",
|
|
48
|
-
FundingPending = "fundingPending",
|
|
49
|
-
FundingFailed = "fundingFailed",
|
|
50
|
-
ActionPending = "actionPending",
|
|
51
|
-
ActionFailed = "actionFailed",
|
|
52
|
-
ActionRetry = "actionRetry",
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface KeeperContract {
|
|
56
|
-
contractIdentifier: string;
|
|
57
|
-
contractStatus: KeeperContractStatus;
|
|
58
|
-
deploymentDate?: Date;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface GetKeeperContractResponse {
|
|
62
|
-
keeperContract: KeeperContract;
|
|
63
|
-
error?: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface GetKeeperContractParams {
|
|
67
|
-
stacksAddress: string;
|
|
68
|
-
keeperType: KeeperType;
|
|
69
|
-
bitcoinAddress?: string;
|
|
70
|
-
deployContract?: boolean;
|
|
71
|
-
allActionsApproved?: boolean;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface MinReceived {
|
|
75
|
-
amount: string;
|
|
76
|
-
autoAdjust: boolean;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface TxRetries {
|
|
80
|
-
deploys: number;
|
|
81
|
-
actions: number;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface KeeperOrder {
|
|
85
|
-
orderId: string;
|
|
86
|
-
userStacksAddress: string;
|
|
87
|
-
userBitcoinAddress: string;
|
|
88
|
-
contractIdentifier: string;
|
|
89
|
-
actionAmount: string;
|
|
90
|
-
minReceived: MinReceived;
|
|
91
|
-
feeRecipient: string;
|
|
92
|
-
actionType: string;
|
|
93
|
-
actionAggregatorTokens: {
|
|
94
|
-
tokenXId: string;
|
|
95
|
-
tokenYId: string;
|
|
96
|
-
};
|
|
97
|
-
fundingTokens: Record<string, any>;
|
|
98
|
-
txIds: Record<string, string>;
|
|
99
|
-
txRetries: {
|
|
100
|
-
deploys: number;
|
|
101
|
-
actions: number;
|
|
102
|
-
};
|
|
103
|
-
requiresPontisTx: boolean;
|
|
104
|
-
keeperType: KeeperType;
|
|
105
|
-
orderStatus: string;
|
|
106
|
-
executeActionAfter: TimestampFormat;
|
|
107
|
-
creationDate: TimestampFormat;
|
|
108
|
-
lastUpdated: TimestampFormat;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
interface TimestampFormat {
|
|
112
|
-
_seconds: number;
|
|
113
|
-
_nanoseconds: number;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface CreateOrderResponse {
|
|
117
|
-
keeperOrder: KeeperOrder;
|
|
118
|
-
error?: string;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface GetOrderResponse {
|
|
122
|
-
order: KeeperOrder;
|
|
123
|
-
error?: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface User {
|
|
127
|
-
stacksAddress: string;
|
|
128
|
-
bitcoinAddress: string;
|
|
129
|
-
keeperContracts: Record<string, KeeperContract>;
|
|
130
|
-
keeperOrders: Record<string, KeeperOrder>;
|
|
131
|
-
creationDate: Date;
|
|
132
|
-
lastUpdated: Date;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface GetUserResponse {
|
|
136
|
-
user: User;
|
|
137
|
-
error?: string;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface CreateOrderParams {
|
|
141
|
-
stacksAddress: string;
|
|
142
|
-
keeperType: KeeperType;
|
|
143
|
-
contractIdentifier: string;
|
|
144
|
-
bitcoinAddress?: string;
|
|
145
|
-
actionAmount?: string;
|
|
146
|
-
minReceived?: {
|
|
147
|
-
amount: string;
|
|
148
|
-
autoAdjust: boolean;
|
|
149
|
-
};
|
|
150
|
-
feeRecipient?: string;
|
|
151
|
-
tokenOrder?: string[];
|
|
152
|
-
actionType: string;
|
|
153
|
-
bitcoinTxId: string;
|
|
154
|
-
fundingTokens?: {
|
|
155
|
-
[key: string]: string;
|
|
156
|
-
};
|
|
157
|
-
actionFunctionArgs?: {
|
|
158
|
-
tokenList?: Record<string, string>;
|
|
159
|
-
xykPoolList?: Record<string, string>;
|
|
160
|
-
stableswapPoolList?: Record<string, string>;
|
|
161
|
-
boolList?: Record<string, string>;
|
|
162
|
-
[key: string]: any;
|
|
163
|
-
};
|
|
164
|
-
actionAggregatorTokens?: {
|
|
165
|
-
tokenXId: string;
|
|
166
|
-
tokenYId: string;
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export interface ActionFunctionArgs {
|
|
171
|
-
actionTrait?: string;
|
|
172
|
-
tokenList?: Record<string, string>;
|
|
173
|
-
xykPoolList?: Record<string, string>;
|
|
174
|
-
stableswapPoolList?: Record<string, string>;
|
|
175
|
-
boolList?: Record<string, string>;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface GetQuoteParams {
|
|
179
|
-
stacksAddress: string;
|
|
180
|
-
actionAmount: string;
|
|
181
|
-
keeperType: KeeperType;
|
|
182
|
-
actionType?: string;
|
|
183
|
-
tokenXId?: string;
|
|
184
|
-
tokenYId?: string;
|
|
185
|
-
minReceived?: {
|
|
186
|
-
amount: string;
|
|
187
|
-
autoAdjust: boolean;
|
|
188
|
-
};
|
|
189
|
-
feeRecipient?: string;
|
|
190
|
-
bitcoinAddress?: string;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export interface GetQuoteResponse {
|
|
194
|
-
quote: string;
|
|
195
|
-
quoteWithSlippage: string;
|
|
196
|
-
keeperType: KeeperType;
|
|
197
|
-
actionType?: string;
|
|
198
|
-
tokenOrder: string[];
|
|
199
|
-
error?: string;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export interface AggregatorRouteData {
|
|
203
|
-
tokenX: string;
|
|
204
|
-
tokenY: string;
|
|
205
|
-
amountX: number;
|
|
206
|
-
routes: SwapRoute[];
|
|
207
|
-
dexPath: string[];
|
|
208
|
-
tokenPath: string[];
|
|
209
|
-
bestRoute?: SwapRoute;
|
|
210
|
-
keeperOrderData?: KeeperOrderRouteData;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export interface SwapRoute {
|
|
214
|
-
poolRoute: string[];
|
|
215
|
-
expectedOutput: number;
|
|
216
|
-
tokenRoute: string[];
|
|
217
|
-
dexRoute: string[];
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
export interface KeeperOrderRouteData {
|
|
221
|
-
tokenList: Record<string, string>;
|
|
222
|
-
xykPoolList: Record<string, string>;
|
|
223
|
-
stableswapPoolList: Record<string, string>;
|
|
224
|
-
boolList: Record<string, string>;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export interface GroupOrder {
|
|
228
|
-
groupId: string;
|
|
229
|
-
userStacksAddress: string;
|
|
230
|
-
orders: KeeperOrder[];
|
|
231
|
-
status: GroupOrderStatus;
|
|
232
|
-
creationDate: Date;
|
|
233
|
-
lastUpdated: Date;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export enum GroupOrderStatus {
|
|
237
|
-
Active = "active",
|
|
238
|
-
Completed = "completed",
|
|
239
|
-
Cancelled = "cancelled",
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export interface CreateGroupOrderParams {
|
|
243
|
-
stacksAddress: string;
|
|
244
|
-
amountPerOrder: number;
|
|
245
|
-
numberOfOrders: number;
|
|
246
|
-
executionFrequency: number;
|
|
247
|
-
feeRecipient: string;
|
|
248
|
-
fundingTokens: {
|
|
249
|
-
[key: string]: string;
|
|
250
|
-
};
|
|
251
|
-
bitcoinTxId?: string;
|
|
252
|
-
stacksTxId?: string;
|
|
253
|
-
keeperType: KeeperType;
|
|
254
|
-
actionType?: string;
|
|
255
|
-
actionFunctionArgs?: ActionFunctionArgs;
|
|
256
|
-
actionPostConditions?: any[];
|
|
257
|
-
actionAggregatorTokens?: {
|
|
258
|
-
tokenXId: string;
|
|
259
|
-
tokenYId: string;
|
|
260
|
-
};
|
|
261
|
-
bitcoinAddress?: string;
|
|
262
|
-
nextExecutionAfter?: Date;
|
|
263
|
-
executeActionAfter?: Date;
|
|
264
|
-
minReceived: {
|
|
265
|
-
amount: string;
|
|
266
|
-
autoAdjust: boolean;
|
|
267
|
-
};
|
|
268
|
-
priceRange?: {
|
|
269
|
-
amount: string;
|
|
270
|
-
minPrice: string;
|
|
271
|
-
maxPrice: string;
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export interface CreateGroupOrderResponse {
|
|
276
|
-
keeperGroupOrder: {
|
|
277
|
-
groupId: string;
|
|
278
|
-
orderIds: string[];
|
|
279
|
-
userStacksAddress: string;
|
|
280
|
-
userBitcoinAddress: string;
|
|
281
|
-
contractIdentifier: string;
|
|
282
|
-
amountPerOrder: string;
|
|
283
|
-
numberOfOrders: string;
|
|
284
|
-
remainingOrders: string;
|
|
285
|
-
executionFrequency: string;
|
|
286
|
-
txIds: {
|
|
287
|
-
bitcoinTxId?: string;
|
|
288
|
-
stacksTxId?: string;
|
|
289
|
-
};
|
|
290
|
-
nextExecutionAfter: Date;
|
|
291
|
-
creationDate: Date;
|
|
292
|
-
lastUpdated: Date;
|
|
293
|
-
};
|
|
294
|
-
error?: string;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export interface GetGroupOrderResponse {
|
|
298
|
-
groupOrder: GroupOrder;
|
|
299
|
-
error?: string;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export interface CancelOrderResponse {
|
|
303
|
-
success: boolean;
|
|
304
|
-
error?: string;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export interface CancelGroupOrderResponse {
|
|
308
|
-
success: boolean;
|
|
309
|
-
error?: string;
|
|
310
|
-
}
|