@velora-dex/sdk 9.3.4-dev.3 → 9.3.4-dev.4
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/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/methods/delta/constants.d.ts +8 -0
- package/dist/methods/delta/constants.d.ts.map +1 -0
- package/dist/methods/delta/deltaTokenModule.d.ts +35 -0
- package/dist/methods/delta/deltaTokenModule.d.ts.map +1 -0
- package/dist/methods/delta/getDeltaPrice.d.ts +1 -8
- package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -1
- package/dist/methods/delta/index.d.ts +2 -1
- package/dist/methods/delta/index.d.ts.map +1 -1
- package/dist/sdk/partial.d.ts +3 -1
- package/dist/sdk/partial.d.ts.map +1 -1
- package/dist/sdk.cjs.development.js +332 -1
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +332 -2
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +12 -0
- package/src/methods/delta/constants.ts +11 -0
- package/src/methods/delta/deltaTokenModule.ts +372 -0
- package/src/methods/delta/getDeltaPrice.ts +0 -14
- package/src/methods/delta/index.ts +9 -1
- package/src/sdk/partial.ts +3 -1
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -216,6 +216,13 @@ import {
|
|
|
216
216
|
CancelDeltaOrderFunctions,
|
|
217
217
|
constructCancelDeltaOrder,
|
|
218
218
|
} from './methods/delta/cancelDeltaOrder';
|
|
219
|
+
import {
|
|
220
|
+
DeltaTokenModuleFunctions,
|
|
221
|
+
CancelAndWithdrawDeltaOrderParams,
|
|
222
|
+
constructDeltaTokenModule,
|
|
223
|
+
DepositNativeAndPreSignParams,
|
|
224
|
+
DepositNativeAndPreSignDeltaOrderParams,
|
|
225
|
+
} from './methods/delta/deltaTokenModule';
|
|
219
226
|
|
|
220
227
|
export { constructSwapSDK, SwapSDKMethods } from './methods/swap';
|
|
221
228
|
|
|
@@ -300,6 +307,7 @@ export {
|
|
|
300
307
|
constructGetDeltaPrice,
|
|
301
308
|
constructGetDeltaOrders,
|
|
302
309
|
constructCancelDeltaOrder,
|
|
310
|
+
constructDeltaTokenModule,
|
|
303
311
|
constructApproveTokenForDelta,
|
|
304
312
|
// Quote methods
|
|
305
313
|
constructGetQuote,
|
|
@@ -395,6 +403,10 @@ export type {
|
|
|
395
403
|
GetDeltaOrdersFunctions,
|
|
396
404
|
ApproveTokenForDeltaFunctions,
|
|
397
405
|
CancelDeltaOrderFunctions,
|
|
406
|
+
DeltaTokenModuleFunctions,
|
|
407
|
+
CancelAndWithdrawDeltaOrderParams,
|
|
408
|
+
DepositNativeAndPreSignParams,
|
|
409
|
+
DepositNativeAndPreSignDeltaOrderParams,
|
|
398
410
|
// types for Quote methods
|
|
399
411
|
GetQuoteFunctions,
|
|
400
412
|
QuoteParams,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ZERO_ADDRESS } from '../common/orders/buildOrderData';
|
|
2
|
+
import { Bridge } from './helpers/types';
|
|
3
|
+
|
|
4
|
+
// for same-chain Orders, all 0 params
|
|
5
|
+
export const DEFAULT_BRIDGE = {
|
|
6
|
+
protocolSelector: '0x00000000', // 4 bytes
|
|
7
|
+
destinationChainId: 0,
|
|
8
|
+
outputToken: ZERO_ADDRESS,
|
|
9
|
+
scalingFactor: 0,
|
|
10
|
+
protocolData: '0x',
|
|
11
|
+
} as const satisfies Bridge;
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConstructProviderFetchInput,
|
|
3
|
+
RequestParameters,
|
|
4
|
+
TxSendOverrides,
|
|
5
|
+
} from '../../types';
|
|
6
|
+
import { constructGetDeltaContract } from './getDeltaContract';
|
|
7
|
+
import { sanitizeDeltaOrderData } from './helpers/misc';
|
|
8
|
+
import { SignableDeltaOrderData } from './helpers/buildDeltaOrderData';
|
|
9
|
+
import { produceDeltaOrderHash } from './preSignDeltaOrder';
|
|
10
|
+
import type { ExtractAbiMethodNames } from '../../helpers/misc';
|
|
11
|
+
import type { Bridge, DeltaAuctionOrder } from './helpers/types';
|
|
12
|
+
import { DEFAULT_BRIDGE } from './constants';
|
|
13
|
+
|
|
14
|
+
export type CancelAndWithdrawDeltaOrderParams = {
|
|
15
|
+
order: DeltaAuctionOrder;
|
|
16
|
+
signature: string;
|
|
17
|
+
bridgeOverride?: Pick<Bridge, 'protocolSelector' | 'protocolData'>;
|
|
18
|
+
cosignature?: string;
|
|
19
|
+
isFillable?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type CancelAndWithdrawDeltaOrder<T> = (
|
|
23
|
+
params: CancelAndWithdrawDeltaOrderParams,
|
|
24
|
+
overrides?: TxSendOverrides,
|
|
25
|
+
requestParams?: RequestParameters
|
|
26
|
+
) => Promise<T>;
|
|
27
|
+
|
|
28
|
+
export type WithdrawDeltaNative<T> = (
|
|
29
|
+
amount: string,
|
|
30
|
+
overrides?: TxSendOverrides,
|
|
31
|
+
requestParams?: RequestParameters
|
|
32
|
+
) => Promise<T>;
|
|
33
|
+
|
|
34
|
+
export type DepositNativeAndPreSignParams = {
|
|
35
|
+
orderHash: string;
|
|
36
|
+
depositAmount: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type DepositNativeAndPreSign<T> = (
|
|
40
|
+
params: DepositNativeAndPreSignParams,
|
|
41
|
+
overrides?: Omit<TxSendOverrides, 'value'>, // value is set internally based on depositAmount
|
|
42
|
+
requestParams?: RequestParameters
|
|
43
|
+
) => Promise<T>;
|
|
44
|
+
|
|
45
|
+
export type DepositNativeAndPreSignDeltaOrderParams = Pick<
|
|
46
|
+
DepositNativeAndPreSignParams,
|
|
47
|
+
'depositAmount'
|
|
48
|
+
> & {
|
|
49
|
+
signableOrderData: SignableDeltaOrderData;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type DepositNativeAndPreSignDeltaOrder<T> = (
|
|
53
|
+
params: DepositNativeAndPreSignDeltaOrderParams,
|
|
54
|
+
overrides?: Omit<TxSendOverrides, 'value'>, // value is set internally based on depositAmount
|
|
55
|
+
requestParams?: RequestParameters
|
|
56
|
+
) => Promise<T>;
|
|
57
|
+
|
|
58
|
+
export type DeltaTokenModuleFunctions<T> = {
|
|
59
|
+
/** @description Cancel an order on-chain and withdraw native ETH back to the owner */
|
|
60
|
+
cancelAndWithdrawDeltaOrder: CancelAndWithdrawDeltaOrder<T>;
|
|
61
|
+
/** @description Withdraw Delta Wrapped Native tokens as native ETH */
|
|
62
|
+
withdrawDeltaNative: WithdrawDeltaNative<T>;
|
|
63
|
+
/** @description Deposit native ETH and pre-sign a Delta order */
|
|
64
|
+
depositNativeAndPreSign: DepositNativeAndPreSign<T>;
|
|
65
|
+
/** @description Deposit native ETH and pre-sign a Delta order from signable order data */
|
|
66
|
+
depositNativeAndPreSignDeltaOrder: DepositNativeAndPreSignDeltaOrder<T>;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const DeltaTokenModuleAbi = [
|
|
70
|
+
{
|
|
71
|
+
type: 'function',
|
|
72
|
+
name: 'cancelAndWithdraw',
|
|
73
|
+
inputs: [
|
|
74
|
+
{
|
|
75
|
+
name: 'orderWithSig',
|
|
76
|
+
type: 'tuple',
|
|
77
|
+
internalType: 'struct OrderWithSig',
|
|
78
|
+
components: [
|
|
79
|
+
{
|
|
80
|
+
name: 'order',
|
|
81
|
+
type: 'tuple',
|
|
82
|
+
internalType: 'struct Order',
|
|
83
|
+
components: [
|
|
84
|
+
{
|
|
85
|
+
name: 'owner',
|
|
86
|
+
type: 'address',
|
|
87
|
+
internalType: 'address',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'beneficiary',
|
|
91
|
+
type: 'address',
|
|
92
|
+
internalType: 'address',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'srcToken',
|
|
96
|
+
type: 'address',
|
|
97
|
+
internalType: 'address',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'destToken',
|
|
101
|
+
type: 'address',
|
|
102
|
+
internalType: 'address',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'srcAmount',
|
|
106
|
+
type: 'uint256',
|
|
107
|
+
internalType: 'uint256',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'destAmount',
|
|
111
|
+
type: 'uint256',
|
|
112
|
+
internalType: 'uint256',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'expectedAmount',
|
|
116
|
+
type: 'uint256',
|
|
117
|
+
internalType: 'uint256',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'deadline',
|
|
121
|
+
type: 'uint256',
|
|
122
|
+
internalType: 'uint256',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'kind',
|
|
126
|
+
type: 'uint8',
|
|
127
|
+
internalType: 'enum OrderKind',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'nonce',
|
|
131
|
+
type: 'uint256',
|
|
132
|
+
internalType: 'uint256',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'partnerAndFee',
|
|
136
|
+
type: 'uint256',
|
|
137
|
+
internalType: 'uint256',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'permit',
|
|
141
|
+
type: 'bytes',
|
|
142
|
+
internalType: 'bytes',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'metadata',
|
|
146
|
+
type: 'bytes',
|
|
147
|
+
internalType: 'bytes',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'bridge',
|
|
151
|
+
type: 'tuple',
|
|
152
|
+
internalType: 'struct Bridge',
|
|
153
|
+
components: [
|
|
154
|
+
{
|
|
155
|
+
name: 'protocolSelector',
|
|
156
|
+
type: 'bytes4',
|
|
157
|
+
internalType: 'bytes4',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'destinationChainId',
|
|
161
|
+
type: 'uint256',
|
|
162
|
+
internalType: 'uint256',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'outputToken',
|
|
166
|
+
type: 'address',
|
|
167
|
+
internalType: 'address',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'scalingFactor',
|
|
171
|
+
type: 'int8',
|
|
172
|
+
internalType: 'int8',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: 'protocolData',
|
|
176
|
+
type: 'bytes',
|
|
177
|
+
internalType: 'bytes',
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'signature',
|
|
185
|
+
type: 'bytes',
|
|
186
|
+
internalType: 'bytes',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'bridgeOverride',
|
|
190
|
+
type: 'tuple',
|
|
191
|
+
internalType: 'struct BridgeOverride',
|
|
192
|
+
components: [
|
|
193
|
+
{
|
|
194
|
+
name: 'protocolSelector',
|
|
195
|
+
type: 'bytes4',
|
|
196
|
+
internalType: 'bytes4',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'protocolData',
|
|
200
|
+
type: 'bytes',
|
|
201
|
+
internalType: 'bytes',
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: 'cosignature',
|
|
207
|
+
type: 'bytes',
|
|
208
|
+
internalType: 'bytes',
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'isFillable',
|
|
214
|
+
type: 'bool',
|
|
215
|
+
internalType: 'bool',
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
outputs: [],
|
|
219
|
+
stateMutability: 'nonpayable',
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
type: 'function',
|
|
223
|
+
name: 'withdrawNative',
|
|
224
|
+
inputs: [
|
|
225
|
+
{
|
|
226
|
+
name: 'amount',
|
|
227
|
+
type: 'uint256',
|
|
228
|
+
internalType: 'uint256',
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
outputs: [],
|
|
232
|
+
stateMutability: 'nonpayable',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: 'function',
|
|
236
|
+
name: 'depositNativeAndPreSign',
|
|
237
|
+
inputs: [
|
|
238
|
+
{
|
|
239
|
+
name: 'orderHash',
|
|
240
|
+
type: 'bytes32',
|
|
241
|
+
internalType: 'bytes32',
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
outputs: [],
|
|
245
|
+
stateMutability: 'payable',
|
|
246
|
+
},
|
|
247
|
+
] as const;
|
|
248
|
+
|
|
249
|
+
type AvailableMethods = ExtractAbiMethodNames<typeof DeltaTokenModuleAbi>;
|
|
250
|
+
|
|
251
|
+
// returns whatever `contractCaller` returns
|
|
252
|
+
// to allow for better versatility
|
|
253
|
+
export const constructDeltaTokenModule = <T>(
|
|
254
|
+
options: Pick<
|
|
255
|
+
ConstructProviderFetchInput<T, 'transactCall'>,
|
|
256
|
+
'contractCaller' | 'fetcher' | 'apiURL' | 'chainId'
|
|
257
|
+
>
|
|
258
|
+
): DeltaTokenModuleFunctions<T> => {
|
|
259
|
+
// cached internally
|
|
260
|
+
const { getDeltaContract } = constructGetDeltaContract(options);
|
|
261
|
+
|
|
262
|
+
const cancelAndWithdrawDeltaOrder: CancelAndWithdrawDeltaOrder<T> = async (
|
|
263
|
+
{
|
|
264
|
+
order,
|
|
265
|
+
signature,
|
|
266
|
+
bridgeOverride = {
|
|
267
|
+
protocolData: DEFAULT_BRIDGE.protocolData,
|
|
268
|
+
protocolSelector: DEFAULT_BRIDGE.protocolSelector,
|
|
269
|
+
},
|
|
270
|
+
cosignature = '0x',
|
|
271
|
+
isFillable = false,
|
|
272
|
+
},
|
|
273
|
+
overrides = {},
|
|
274
|
+
requestParams
|
|
275
|
+
) => {
|
|
276
|
+
const ParaswapDelta = await getDeltaContract(requestParams);
|
|
277
|
+
if (!ParaswapDelta) {
|
|
278
|
+
throw new Error(`Delta is not available on chain ${options.chainId}`);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const orderWithSig = {
|
|
282
|
+
order,
|
|
283
|
+
signature,
|
|
284
|
+
bridgeOverride,
|
|
285
|
+
cosignature,
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const res = await options.contractCaller.transactCall<AvailableMethods>({
|
|
289
|
+
address: ParaswapDelta,
|
|
290
|
+
abi: DeltaTokenModuleAbi,
|
|
291
|
+
contractMethod: 'cancelAndWithdraw',
|
|
292
|
+
args: [orderWithSig, isFillable],
|
|
293
|
+
overrides,
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
return res;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const withdrawDeltaNative: WithdrawDeltaNative<T> = async (
|
|
300
|
+
amount,
|
|
301
|
+
overrides = {},
|
|
302
|
+
requestParams
|
|
303
|
+
) => {
|
|
304
|
+
const ParaswapDelta = await getDeltaContract(requestParams);
|
|
305
|
+
if (!ParaswapDelta) {
|
|
306
|
+
throw new Error(`Delta is not available on chain ${options.chainId}`);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const res = await options.contractCaller.transactCall<AvailableMethods>({
|
|
310
|
+
address: ParaswapDelta,
|
|
311
|
+
abi: DeltaTokenModuleAbi,
|
|
312
|
+
contractMethod: 'withdrawNative',
|
|
313
|
+
args: [amount],
|
|
314
|
+
overrides,
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
return res;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
const depositNativeAndPreSign: DepositNativeAndPreSign<T> = async (
|
|
321
|
+
{ orderHash, depositAmount },
|
|
322
|
+
overrides = {},
|
|
323
|
+
requestParams
|
|
324
|
+
) => {
|
|
325
|
+
const ParaswapDelta = await getDeltaContract(requestParams);
|
|
326
|
+
if (!ParaswapDelta) {
|
|
327
|
+
throw new Error(`Delta is not available on chain ${options.chainId}`);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
const res = await options.contractCaller.transactCall<AvailableMethods>({
|
|
331
|
+
address: ParaswapDelta,
|
|
332
|
+
abi: DeltaTokenModuleAbi,
|
|
333
|
+
contractMethod: 'depositNativeAndPreSign',
|
|
334
|
+
args: [orderHash],
|
|
335
|
+
overrides: {
|
|
336
|
+
...overrides,
|
|
337
|
+
value: depositAmount,
|
|
338
|
+
},
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
return res;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const depositNativeAndPreSignDeltaOrder: DepositNativeAndPreSignDeltaOrder<
|
|
345
|
+
T
|
|
346
|
+
> = async (
|
|
347
|
+
{ signableOrderData, depositAmount },
|
|
348
|
+
overrides = {},
|
|
349
|
+
requestParams
|
|
350
|
+
) => {
|
|
351
|
+
// types allow to pass OrderData & extra_stuff, but tx will break like that
|
|
352
|
+
const typedDataOnly: SignableDeltaOrderData = {
|
|
353
|
+
...signableOrderData,
|
|
354
|
+
data: sanitizeDeltaOrderData(signableOrderData.data),
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const orderHash = produceDeltaOrderHash(typedDataOnly);
|
|
358
|
+
const res = await depositNativeAndPreSign(
|
|
359
|
+
{ orderHash, depositAmount },
|
|
360
|
+
overrides,
|
|
361
|
+
requestParams
|
|
362
|
+
);
|
|
363
|
+
return res;
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
return {
|
|
367
|
+
cancelAndWithdrawDeltaOrder,
|
|
368
|
+
withdrawDeltaNative,
|
|
369
|
+
depositNativeAndPreSign,
|
|
370
|
+
depositNativeAndPreSignDeltaOrder,
|
|
371
|
+
};
|
|
372
|
+
};
|
|
@@ -7,7 +7,6 @@ import type {
|
|
|
7
7
|
EnumerateLiteral,
|
|
8
8
|
RequestParameters,
|
|
9
9
|
} from '../../types';
|
|
10
|
-
import { ZERO_ADDRESS } from '../common/orders/buildOrderData';
|
|
11
10
|
import { BridgePriceInfo } from './helpers/types';
|
|
12
11
|
|
|
13
12
|
type SwapSideUnion = EnumerateLiteral<typeof SwapSide>;
|
|
@@ -56,15 +55,6 @@ type DeltaPriceQueryOptions = Omit<
|
|
|
56
55
|
excludeBridges?: string;
|
|
57
56
|
};
|
|
58
57
|
|
|
59
|
-
// for same-chain Orders, all 0 params
|
|
60
|
-
export const DEFAULT_BRIDGE = {
|
|
61
|
-
protocolSelector: '0x00000000', // 4 bytes
|
|
62
|
-
destinationChainId: 0,
|
|
63
|
-
outputToken: ZERO_ADDRESS,
|
|
64
|
-
scalingFactor: 0,
|
|
65
|
-
protocolData: '0x',
|
|
66
|
-
} as const satisfies Bridge;
|
|
67
|
-
|
|
68
58
|
export type DeltaPrice = {
|
|
69
59
|
srcToken: string;
|
|
70
60
|
destToken: string;
|
|
@@ -99,10 +89,6 @@ export type DeltaPrice = {
|
|
|
99
89
|
|
|
100
90
|
type AvailableBridgePrice = Pick<
|
|
101
91
|
DeltaPrice,
|
|
102
|
-
| 'srcAmount'
|
|
103
|
-
| 'srcAmountBeforeFee' // Available for BUY side
|
|
104
|
-
| 'srcUSD'
|
|
105
|
-
| 'srcUSDBeforeFee' // Available for BUY side
|
|
106
92
|
| 'destToken'
|
|
107
93
|
| 'destAmount'
|
|
108
94
|
| 'destAmountBeforeFee' // Available for SELL side
|
|
@@ -50,6 +50,10 @@ import {
|
|
|
50
50
|
constructPreSignDeltaOrder,
|
|
51
51
|
PreSignDeltaOrderFunctions,
|
|
52
52
|
} from './preSignDeltaOrder';
|
|
53
|
+
import {
|
|
54
|
+
DeltaTokenModuleFunctions,
|
|
55
|
+
constructDeltaTokenModule,
|
|
56
|
+
} from './deltaTokenModule';
|
|
53
57
|
|
|
54
58
|
export type SubmitDeltaOrderParams = BuildDeltaOrderDataParams & {
|
|
55
59
|
/** @description designates the Order as being able to be partially filled, as opposed to fill-or-kill */
|
|
@@ -107,7 +111,8 @@ export type DeltaOrderHandlers<T> = SubmitDeltaOrderFuncs &
|
|
|
107
111
|
PostDeltaOrderFunctions &
|
|
108
112
|
SignDeltaOrderFunctions &
|
|
109
113
|
PreSignDeltaOrderFunctions<T> &
|
|
110
|
-
CancelDeltaOrderFunctions
|
|
114
|
+
CancelDeltaOrderFunctions &
|
|
115
|
+
DeltaTokenModuleFunctions<T>;
|
|
111
116
|
|
|
112
117
|
/** @description construct SDK with every Delta Order-related method, fetching from API and Order signing */
|
|
113
118
|
export const constructAllDeltaOrdersHandlers = <TxResponse>(
|
|
@@ -135,6 +140,8 @@ export const constructAllDeltaOrdersHandlers = <TxResponse>(
|
|
|
135
140
|
|
|
136
141
|
const deltaOrdersCancel = constructCancelDeltaOrder(options);
|
|
137
142
|
|
|
143
|
+
const deltaTokenModule = constructDeltaTokenModule(options);
|
|
144
|
+
|
|
138
145
|
return {
|
|
139
146
|
...deltaOrdersGetters,
|
|
140
147
|
...deltaOrdersContractGetter,
|
|
@@ -149,5 +156,6 @@ export const constructAllDeltaOrdersHandlers = <TxResponse>(
|
|
|
149
156
|
...deltaOrdersPreSign,
|
|
150
157
|
...deltaOrdersPost,
|
|
151
158
|
...deltaOrdersCancel,
|
|
159
|
+
...deltaTokenModule,
|
|
152
160
|
};
|
|
153
161
|
};
|
package/src/sdk/partial.ts
CHANGED
|
@@ -13,6 +13,7 @@ import type { ApproveTokenForNFTOrderFunctions } from '../methods/nftOrders/appr
|
|
|
13
13
|
import type { FillOrderDirectlyFunctions } from '../methods/limitOrders/fillOrderDirectly';
|
|
14
14
|
import type { ApproveTokenForDeltaFunctions } from '../methods/delta/approveForDelta';
|
|
15
15
|
import type { PreSignDeltaOrderFunctions } from '../methods/delta/preSignDeltaOrder';
|
|
16
|
+
import type { DeltaTokenModuleFunctions } from '../methods/delta/deltaTokenModule';
|
|
16
17
|
import { API_URL, DEFAULT_VERSION } from '../constants';
|
|
17
18
|
|
|
18
19
|
export type SDKConfig<TxResponse = any> = ConstructProviderFetchInput<
|
|
@@ -52,7 +53,8 @@ type InferWithTxResponse<
|
|
|
52
53
|
CancelNFTOrderFunctions<TxResponse>,
|
|
53
54
|
ApproveTokenForNFTOrderFunctions<TxResponse>,
|
|
54
55
|
ApproveTokenForDeltaFunctions<TxResponse>,
|
|
55
|
-
PreSignDeltaOrderFunctions<TxResponse
|
|
56
|
+
PreSignDeltaOrderFunctions<TxResponse>,
|
|
57
|
+
DeltaTokenModuleFunctions<TxResponse>
|
|
56
58
|
]
|
|
57
59
|
// then merge IntersectionOfReturns<Funcs> with them recursively
|
|
58
60
|
>
|