@velora-dex/sdk 9.4.0 → 9.4.1-dev.1
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 +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/methods/delta/buildTWAPDeltaOrder.d.ts +65 -0
- package/dist/methods/delta/buildTWAPDeltaOrder.d.ts.map +1 -0
- package/dist/methods/delta/helpers/buildTWAPOrderData.d.ts +74 -0
- package/dist/methods/delta/helpers/buildTWAPOrderData.d.ts.map +1 -0
- package/dist/methods/delta/helpers/misc.d.ts +8 -0
- package/dist/methods/delta/helpers/misc.d.ts.map +1 -1
- package/dist/methods/delta/helpers/types.d.ts +43 -2
- package/dist/methods/delta/helpers/types.d.ts.map +1 -1
- package/dist/methods/delta/index.d.ts +16 -1
- package/dist/methods/delta/index.d.ts.map +1 -1
- package/dist/methods/delta/postTWAPDeltaOrder.d.ts +16 -0
- package/dist/methods/delta/postTWAPDeltaOrder.d.ts.map +1 -0
- package/dist/methods/delta/preSignTWAPDeltaOrder.d.ts +20 -0
- package/dist/methods/delta/preSignTWAPDeltaOrder.d.ts.map +1 -0
- package/dist/methods/delta/signTWAPDeltaOrder.d.ts +9 -0
- package/dist/methods/delta/signTWAPDeltaOrder.d.ts.map +1 -0
- package/dist/sdk/partial.d.ts +3 -1
- package/dist/sdk/partial.d.ts.map +1 -1
- package/dist/sdk.cjs.development.js +610 -25
- 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 +606 -26
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.js +1 -6
- package/src/index.js +68 -125
- package/src/index.ts +63 -0
- package/src/methods/delta/buildTWAPDeltaOrder.ts +181 -0
- package/src/methods/delta/helpers/buildTWAPOrderData.ts +227 -0
- package/src/methods/delta/helpers/misc.ts +35 -1
- package/src/methods/delta/helpers/types.ts +52 -2
- package/src/methods/delta/index.ts +78 -1
- package/src/methods/delta/postTWAPDeltaOrder.ts +57 -0
- package/src/methods/delta/preSignTWAPDeltaOrder.ts +168 -0
- package/src/methods/delta/signTWAPDeltaOrder.ts +32 -0
- package/src/sdk/partial.ts +3 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ConstructProviderFetchInput } from '../../types';
|
|
2
|
+
import { SignableTWAPOrderData } from './helpers/buildTWAPOrderData';
|
|
3
|
+
import { sanitizeTWAPOrderData } from './helpers/misc';
|
|
4
|
+
|
|
5
|
+
type SignTWAPDeltaOrder = (
|
|
6
|
+
signableOrderData: SignableTWAPOrderData
|
|
7
|
+
) => Promise<string>;
|
|
8
|
+
|
|
9
|
+
export type SignTWAPDeltaOrderFunctions = {
|
|
10
|
+
signTWAPDeltaOrder: SignTWAPDeltaOrder;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const constructSignTWAPDeltaOrder = (
|
|
14
|
+
options: Pick<
|
|
15
|
+
ConstructProviderFetchInput<any, 'signTypedDataCall'>,
|
|
16
|
+
'contractCaller'
|
|
17
|
+
>
|
|
18
|
+
): SignTWAPDeltaOrderFunctions => {
|
|
19
|
+
const signTWAPDeltaOrder: SignTWAPDeltaOrder = async (typedData) => {
|
|
20
|
+
const typedDataOnly = {
|
|
21
|
+
...typedData,
|
|
22
|
+
data: sanitizeTWAPOrderData(typedData.data),
|
|
23
|
+
} as SignableTWAPOrderData;
|
|
24
|
+
const signature = await options.contractCaller.signTypedDataCall(
|
|
25
|
+
typedDataOnly
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return signature;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return { signTWAPDeltaOrder };
|
|
32
|
+
};
|
package/src/sdk/partial.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { ApproveTokenForDeltaFunctions } from '../methods/delta/approveForD
|
|
|
15
15
|
import type { PreSignDeltaOrderFunctions } from '../methods/delta/preSignDeltaOrder';
|
|
16
16
|
import type { PreSignExternalDeltaOrderFunctions } from '../methods/delta/preSignExternalDeltaOrder';
|
|
17
17
|
import type { DeltaTokenModuleFunctions } from '../methods/delta/deltaTokenModule';
|
|
18
|
+
import type { PreSignTWAPDeltaOrderFunctions } from '../methods/delta/preSignTWAPDeltaOrder';
|
|
18
19
|
import { API_URL, DEFAULT_VERSION } from '../constants';
|
|
19
20
|
|
|
20
21
|
export type SDKConfig<TxResponse = any> = ConstructProviderFetchInput<
|
|
@@ -56,7 +57,8 @@ type InferWithTxResponse<
|
|
|
56
57
|
ApproveTokenForDeltaFunctions<TxResponse>,
|
|
57
58
|
PreSignDeltaOrderFunctions<TxResponse>,
|
|
58
59
|
PreSignExternalDeltaOrderFunctions<TxResponse>,
|
|
59
|
-
DeltaTokenModuleFunctions<TxResponse
|
|
60
|
+
DeltaTokenModuleFunctions<TxResponse>,
|
|
61
|
+
PreSignTWAPDeltaOrderFunctions<TxResponse>
|
|
60
62
|
]
|
|
61
63
|
// then merge IntersectionOfReturns<Funcs> with them recursively
|
|
62
64
|
>
|