@seal-protocol/backendjs 0.0.130 → 0.0.132
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/lib/codegen/api/seal-client.d.ts +221 -107
- package/lib/codegen/api/seal-client.js +217 -117
- package/lib/codegen/model/index.d.ts +8 -5
- package/lib/codegen/model/index.js +8 -5
- package/lib/codegen/model/{seal-domain-info.d.ts → seal-get-order-stats-for-owner-response.d.ts} +6 -18
- package/lib/codegen/model/seal-get-rfq-activities-response.d.ts +31 -0
- package/lib/codegen/model/seal-order.d.ts +30 -0
- package/lib/codegen/model/seal-rfq-activities-order-by-property.d.ts +22 -0
- package/lib/codegen/model/seal-rfq-activities-order-by-property.js +28 -0
- package/lib/codegen/model/seal-rfq-activities-order-by.d.ts +31 -0
- package/lib/codegen/model/seal-rfq-activity.d.ts +75 -0
- package/lib/codegen/model/{seal-approval-type.d.ts → seal-rfq-activity.js} +4 -11
- package/lib/codegen/model/{seal-orders-order-by-property.d.ts → types-orders-order-by-property.d.ts} +1 -1
- package/lib/codegen/model/types-orders-order-by-property.js +37 -0
- package/lib/codegen/model/{seal-orders-order-by.d.ts → types-orders-order-by.d.ts} +7 -7
- package/lib/codegen/model/types-orders-order-by.js +15 -0
- package/lib/codegen/model/types-rfq-activity-type.d.ts +25 -0
- package/lib/codegen/model/types-rfq-activity-type.js +31 -0
- package/lib/utils/calculate-liquidity.d.ts +21 -1
- package/lib/utils/calculate-liquidity.js +54 -11
- package/lib/utils/calculate-required-permit.d.ts +36 -0
- package/lib/utils/calculate-required-permit.js +111 -0
- package/lib/utils/index.d.ts +3 -1
- package/lib/utils/index.js +20 -1
- package/package.json +1 -1
- package/lib/codegen/model/seal-approval-type.js +0 -28
- package/lib/codegen/model/seal-calculate-required-permit-response.d.ts +0 -74
- package/lib/codegen/model/seal-orders-order-by-property.js +0 -37
- /package/lib/codegen/model/{seal-calculate-required-permit-response.js → seal-get-order-stats-for-owner-response.js} +0 -0
- /package/lib/codegen/model/{seal-domain-info.js → seal-get-rfq-activities-response.js} +0 -0
- /package/lib/codegen/model/{seal-orders-order-by.js → seal-rfq-activities-order-by.js} +0 -0
package/lib/codegen/model/{seal-domain-info.d.ts → seal-get-order-stats-for-owner-response.d.ts}
RENAMED
|
@@ -12,31 +12,19 @@
|
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
14
14
|
* @export
|
|
15
|
-
* @interface
|
|
15
|
+
* @interface SealGetOrderStatsForOwnerResponse
|
|
16
16
|
*/
|
|
17
|
-
export interface
|
|
17
|
+
export interface SealGetOrderStatsForOwnerResponse {
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
* @type {string}
|
|
21
|
-
* @memberof
|
|
21
|
+
* @memberof SealGetOrderStatsForOwnerResponse
|
|
22
22
|
*/
|
|
23
|
-
'
|
|
23
|
+
'count'?: string;
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
* @type {string}
|
|
27
|
-
* @memberof
|
|
27
|
+
* @memberof SealGetOrderStatsForOwnerResponse
|
|
28
28
|
*/
|
|
29
|
-
'
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @type {string}
|
|
33
|
-
* @memberof SealDomainInfo
|
|
34
|
-
*/
|
|
35
|
-
'verifyingContract'?: string;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @type {string}
|
|
39
|
-
* @memberof SealDomainInfo
|
|
40
|
-
*/
|
|
41
|
-
'chainId'?: string;
|
|
29
|
+
'remaining'?: string;
|
|
42
30
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seal/seal.proto
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: version not set
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { SealRfqActivity } from './seal-rfq-activity';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface SealGetRfqActivitiesResponse
|
|
17
|
+
*/
|
|
18
|
+
export interface SealGetRfqActivitiesResponse {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Array<SealRfqActivity>}
|
|
22
|
+
* @memberof SealGetRfqActivitiesResponse
|
|
23
|
+
*/
|
|
24
|
+
'activities': Array<SealRfqActivity>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof SealGetRfqActivitiesResponse
|
|
29
|
+
*/
|
|
30
|
+
'paginationNextKey'?: string;
|
|
31
|
+
}
|
|
@@ -215,4 +215,34 @@ export interface SealOrder {
|
|
|
215
215
|
* @memberof SealOrder
|
|
216
216
|
*/
|
|
217
217
|
'permit'?: SealTokenPermitApproval;
|
|
218
|
+
/**
|
|
219
|
+
*
|
|
220
|
+
* @type {string}
|
|
221
|
+
* @memberof SealOrder
|
|
222
|
+
*/
|
|
223
|
+
'priceMargin'?: string;
|
|
224
|
+
/**
|
|
225
|
+
*
|
|
226
|
+
* @type {string}
|
|
227
|
+
* @memberof SealOrder
|
|
228
|
+
*/
|
|
229
|
+
'tokenInPrice'?: string;
|
|
230
|
+
/**
|
|
231
|
+
*
|
|
232
|
+
* @type {TypesTimestamp}
|
|
233
|
+
* @memberof SealOrder
|
|
234
|
+
*/
|
|
235
|
+
'tokenInPriceTime'?: TypesTimestamp;
|
|
236
|
+
/**
|
|
237
|
+
*
|
|
238
|
+
* @type {string}
|
|
239
|
+
* @memberof SealOrder
|
|
240
|
+
*/
|
|
241
|
+
'tokenOutPrice'?: string;
|
|
242
|
+
/**
|
|
243
|
+
*
|
|
244
|
+
* @type {TypesTimestamp}
|
|
245
|
+
* @memberof SealOrder
|
|
246
|
+
*/
|
|
247
|
+
'tokenOutPriceTime'?: TypesTimestamp;
|
|
218
248
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seal/seal.proto
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: version not set
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @enum {string}
|
|
16
|
+
*/
|
|
17
|
+
export declare enum SealRfqActivitiesOrderByProperty {
|
|
18
|
+
RfqActivitiesOrderByPropertyUnspecified = "RfqActivitiesOrderByProperty_UNSPECIFIED",
|
|
19
|
+
RfqActivitiesOrderByPropertyActivityId = "RfqActivitiesOrderByProperty_ACTIVITY_ID",
|
|
20
|
+
RfqActivitiesOrderByPropertyChainId = "RfqActivitiesOrderByProperty_CHAIN_ID",
|
|
21
|
+
RfqActivitiesOrderByPropertyActivityTime = "RfqActivitiesOrderByProperty_ACTIVITY_TIME"
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* seal/seal.proto
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: version not set
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.SealRfqActivitiesOrderByProperty = void 0;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @enum {string}
|
|
21
|
+
*/
|
|
22
|
+
var SealRfqActivitiesOrderByProperty;
|
|
23
|
+
(function (SealRfqActivitiesOrderByProperty) {
|
|
24
|
+
SealRfqActivitiesOrderByProperty["RfqActivitiesOrderByPropertyUnspecified"] = "RfqActivitiesOrderByProperty_UNSPECIFIED";
|
|
25
|
+
SealRfqActivitiesOrderByProperty["RfqActivitiesOrderByPropertyActivityId"] = "RfqActivitiesOrderByProperty_ACTIVITY_ID";
|
|
26
|
+
SealRfqActivitiesOrderByProperty["RfqActivitiesOrderByPropertyChainId"] = "RfqActivitiesOrderByProperty_CHAIN_ID";
|
|
27
|
+
SealRfqActivitiesOrderByProperty["RfqActivitiesOrderByPropertyActivityTime"] = "RfqActivitiesOrderByProperty_ACTIVITY_TIME";
|
|
28
|
+
})(SealRfqActivitiesOrderByProperty || (exports.SealRfqActivitiesOrderByProperty = SealRfqActivitiesOrderByProperty = {}));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seal/seal.proto
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: version not set
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { SealRfqActivitiesOrderByProperty } from './seal-rfq-activities-order-by-property';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface SealRfqActivitiesOrderBy
|
|
17
|
+
*/
|
|
18
|
+
export interface SealRfqActivitiesOrderBy {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {SealRfqActivitiesOrderByProperty}
|
|
22
|
+
* @memberof SealRfqActivitiesOrderBy
|
|
23
|
+
*/
|
|
24
|
+
'property'?: SealRfqActivitiesOrderByProperty;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
* @memberof SealRfqActivitiesOrderBy
|
|
29
|
+
*/
|
|
30
|
+
'descending'?: boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seal/seal.proto
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: version not set
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import type { SealRfqRequest } from './seal-rfq-request';
|
|
13
|
+
import type { TypesRfqActivityType } from './types-rfq-activity-type';
|
|
14
|
+
import type { TypesTimestamp } from './types-timestamp';
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @export
|
|
18
|
+
* @interface SealRfqActivity
|
|
19
|
+
*/
|
|
20
|
+
export interface SealRfqActivity {
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @type {string}
|
|
24
|
+
* @memberof SealRfqActivity
|
|
25
|
+
*/
|
|
26
|
+
'id'?: string;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @type {string}
|
|
30
|
+
* @memberof SealRfqActivity
|
|
31
|
+
*/
|
|
32
|
+
'chainId'?: string;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {string}
|
|
36
|
+
* @memberof SealRfqActivity
|
|
37
|
+
*/
|
|
38
|
+
'requestId'?: string;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @type {TypesRfqActivityType}
|
|
42
|
+
* @memberof SealRfqActivity
|
|
43
|
+
*/
|
|
44
|
+
'activityType'?: TypesRfqActivityType;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @type {string}
|
|
48
|
+
* @memberof SealRfqActivity
|
|
49
|
+
*/
|
|
50
|
+
'data'?: string;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @type {string}
|
|
54
|
+
* @memberof SealRfqActivity
|
|
55
|
+
*/
|
|
56
|
+
'txHash'?: string;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @type {TypesTimestamp}
|
|
60
|
+
* @memberof SealRfqActivity
|
|
61
|
+
*/
|
|
62
|
+
'time'?: TypesTimestamp;
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @type {string}
|
|
66
|
+
* @memberof SealRfqActivity
|
|
67
|
+
*/
|
|
68
|
+
'actor'?: string;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @type {SealRfqRequest}
|
|
72
|
+
* @memberof SealRfqActivity
|
|
73
|
+
*/
|
|
74
|
+
'request': SealRfqRequest;
|
|
75
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
1
4
|
/**
|
|
2
5
|
* seal/seal.proto
|
|
3
6
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
@@ -9,14 +12,4 @@
|
|
|
9
12
|
* https://openapi-generator.tech
|
|
10
13
|
* Do not edit the class manually.
|
|
11
14
|
*/
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* @export
|
|
15
|
-
* @enum {string}
|
|
16
|
-
*/
|
|
17
|
-
export declare enum SealApprovalType {
|
|
18
|
-
ApprovalTypeUnspecified = "ApprovalType_UNSPECIFIED",
|
|
19
|
-
ApprovalTypeEip2612 = "ApprovalType_EIP2612",
|
|
20
|
-
ApprovalTypePermit2 = "ApprovalType_PERMIT2",
|
|
21
|
-
ApprovalTypeErc20 = "ApprovalType_ERC20"
|
|
22
|
-
}
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/codegen/model/{seal-orders-order-by-property.d.ts → types-orders-order-by-property.d.ts}
RENAMED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @export
|
|
15
15
|
* @enum {string}
|
|
16
16
|
*/
|
|
17
|
-
export declare enum
|
|
17
|
+
export declare enum TypesOrdersOrderByProperty {
|
|
18
18
|
OrdersOrderByPropertyUnspecified = "OrdersOrderByProperty_UNSPECIFIED",
|
|
19
19
|
OrdersOrderByPropertyId = "OrdersOrderByProperty_ID",
|
|
20
20
|
OrdersOrderByPropertyOwner = "OrdersOrderByProperty_OWNER",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* seal/seal.proto
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: version not set
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TypesOrdersOrderByProperty = void 0;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @enum {string}
|
|
21
|
+
*/
|
|
22
|
+
var TypesOrdersOrderByProperty;
|
|
23
|
+
(function (TypesOrdersOrderByProperty) {
|
|
24
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyUnspecified"] = "OrdersOrderByProperty_UNSPECIFIED";
|
|
25
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyId"] = "OrdersOrderByProperty_ID";
|
|
26
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyOwner"] = "OrdersOrderByProperty_OWNER";
|
|
27
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyTokenIn"] = "OrdersOrderByProperty_TOKEN_IN";
|
|
28
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyTokenOut"] = "OrdersOrderByProperty_TOKEN_OUT";
|
|
29
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyAmountIn"] = "OrdersOrderByProperty_AMOUNT_IN";
|
|
30
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyPrice"] = "OrdersOrderByProperty_PRICE";
|
|
31
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyDeadline"] = "OrdersOrderByProperty_DEADLINE";
|
|
32
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyReservationDepositToken"] = "OrdersOrderByProperty_RESERVATION_DEPOSIT_TOKEN";
|
|
33
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyMinReservationDepositAmount"] = "OrdersOrderByProperty_MIN_RESERVATION_DEPOSIT_AMOUNT";
|
|
34
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyRemainingAmount"] = "OrdersOrderByProperty_REMAINING_AMOUNT";
|
|
35
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyReservedAmount"] = "OrdersOrderByProperty_RESERVED_AMOUNT";
|
|
36
|
+
TypesOrdersOrderByProperty["OrdersOrderByPropertyFilledAmount"] = "OrdersOrderByProperty_FILLED_AMOUNT";
|
|
37
|
+
})(TypesOrdersOrderByProperty || (exports.TypesOrdersOrderByProperty = TypesOrdersOrderByProperty = {}));
|
|
@@ -9,23 +9,23 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { TypesOrdersOrderByProperty } from './types-orders-order-by-property';
|
|
13
13
|
/**
|
|
14
14
|
*
|
|
15
15
|
* @export
|
|
16
|
-
* @interface
|
|
16
|
+
* @interface TypesOrdersOrderBy
|
|
17
17
|
*/
|
|
18
|
-
export interface
|
|
18
|
+
export interface TypesOrdersOrderBy {
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @type {
|
|
22
|
-
* @memberof
|
|
21
|
+
* @type {TypesOrdersOrderByProperty}
|
|
22
|
+
* @memberof TypesOrdersOrderBy
|
|
23
23
|
*/
|
|
24
|
-
'property'?:
|
|
24
|
+
'property'?: TypesOrdersOrderByProperty;
|
|
25
25
|
/**
|
|
26
26
|
*
|
|
27
27
|
* @type {boolean}
|
|
28
|
-
* @memberof
|
|
28
|
+
* @memberof TypesOrdersOrderBy
|
|
29
29
|
*/
|
|
30
30
|
'descending'?: boolean;
|
|
31
31
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* seal/seal.proto
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: version not set
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seal/seal.proto
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: version not set
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @enum {string}
|
|
16
|
+
*/
|
|
17
|
+
export declare enum TypesRfqActivityType {
|
|
18
|
+
RfqActivityTypeUnspecified = "RFQ_ACTIVITY_TYPE_UNSPECIFIED",
|
|
19
|
+
RfqActivityTypeRequestSubmitted = "RFQ_ACTIVITY_TYPE_REQUEST_SUBMITTED",
|
|
20
|
+
RfqActivityTypeCommitmentSettled = "RFQ_ACTIVITY_TYPE_COMMITMENT_SETTLED",
|
|
21
|
+
RfqActivityTypeQuoteAccepted = "RFQ_ACTIVITY_TYPE_QUOTE_ACCEPTED",
|
|
22
|
+
RfqActivityTypeCommitmentDefaulted = "RFQ_ACTIVITY_TYPE_COMMITMENT_DEFAULTED",
|
|
23
|
+
RfqActivityTypeQuoteSubmitted = "RFQ_ACTIVITY_TYPE_QUOTE_SUBMITTED",
|
|
24
|
+
RfqActivityDefaultedCommitmentClosed = "RFQ_ACTIVITY_DEFAULTED_COMMITMENT_CLOSED"
|
|
25
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* seal/seal.proto
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: version not set
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.TypesRfqActivityType = void 0;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @enum {string}
|
|
21
|
+
*/
|
|
22
|
+
var TypesRfqActivityType;
|
|
23
|
+
(function (TypesRfqActivityType) {
|
|
24
|
+
TypesRfqActivityType["RfqActivityTypeUnspecified"] = "RFQ_ACTIVITY_TYPE_UNSPECIFIED";
|
|
25
|
+
TypesRfqActivityType["RfqActivityTypeRequestSubmitted"] = "RFQ_ACTIVITY_TYPE_REQUEST_SUBMITTED";
|
|
26
|
+
TypesRfqActivityType["RfqActivityTypeCommitmentSettled"] = "RFQ_ACTIVITY_TYPE_COMMITMENT_SETTLED";
|
|
27
|
+
TypesRfqActivityType["RfqActivityTypeQuoteAccepted"] = "RFQ_ACTIVITY_TYPE_QUOTE_ACCEPTED";
|
|
28
|
+
TypesRfqActivityType["RfqActivityTypeCommitmentDefaulted"] = "RFQ_ACTIVITY_TYPE_COMMITMENT_DEFAULTED";
|
|
29
|
+
TypesRfqActivityType["RfqActivityTypeQuoteSubmitted"] = "RFQ_ACTIVITY_TYPE_QUOTE_SUBMITTED";
|
|
30
|
+
TypesRfqActivityType["RfqActivityDefaultedCommitmentClosed"] = "RFQ_ACTIVITY_DEFAULTED_COMMITMENT_CLOSED";
|
|
31
|
+
})(TypesRfqActivityType || (exports.TypesRfqActivityType = TypesRfqActivityType = {}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Erc20 } from "../abi-types";
|
|
1
2
|
import { type SealTokenPermitApproval, SealTransferPermission } from "../codegen";
|
|
2
3
|
import { ContractRunner } from "ethers";
|
|
3
4
|
export type TransferPermission = {
|
|
@@ -22,4 +23,23 @@ export type CalculateLiquidityParams = {
|
|
|
22
23
|
minPermissionDurationMs: number;
|
|
23
24
|
permission?: SealTokenPermitApproval;
|
|
24
25
|
};
|
|
25
|
-
export declare function
|
|
26
|
+
export declare function fetchOnChainAllowance(params: {
|
|
27
|
+
provider: ContractRunner;
|
|
28
|
+
erc20Contract: Erc20;
|
|
29
|
+
owner: string;
|
|
30
|
+
spender: string;
|
|
31
|
+
token: string;
|
|
32
|
+
minPermissionDurationMs?: number;
|
|
33
|
+
deadlineUnixSeconds?: number;
|
|
34
|
+
permit2ContractAddress?: string;
|
|
35
|
+
requiredAmount?: bigint;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
onChainAllowance: bigint;
|
|
38
|
+
onChainAllowanceToPermit2Contract?: bigint;
|
|
39
|
+
onChainPermit2?: bigint;
|
|
40
|
+
maxAllowed?: bigint;
|
|
41
|
+
isRequiredAmountCovered: boolean;
|
|
42
|
+
permit2Nonce?: bigint;
|
|
43
|
+
}>;
|
|
44
|
+
declare function calculateLiquidity(params: CalculateLiquidityParams): Promise<LiquidityBreakdown>;
|
|
45
|
+
export default calculateLiquidity;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LiquidityBreakdown = void 0;
|
|
4
|
-
exports.
|
|
4
|
+
exports.fetchOnChainAllowance = fetchOnChainAllowance;
|
|
5
5
|
const abi_types_1 = require("../abi-types");
|
|
6
6
|
const codegen_1 = require("../codegen");
|
|
7
7
|
class LiquidityBreakdown {
|
|
@@ -70,26 +70,48 @@ function effectiveOffchainAmount(p) {
|
|
|
70
70
|
return p.Permit2;
|
|
71
71
|
return 0n;
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const erc20Contract = abi_types_1.Erc20__factory.connect(token, provider);
|
|
78
|
-
const permit2Contract = abi_types_1.Permit2__factory.connect(permit2, provider);
|
|
79
|
-
// 1) On-chain balance
|
|
80
|
-
const balance = await erc20Contract.balanceOf(owner);
|
|
73
|
+
// if the token does not support permit2 you can pass in undefined for permit2 contract
|
|
74
|
+
// if the requiredAmount was passed, not all on-chain permits would be fetched, and will fetch only as much as needed
|
|
75
|
+
async function fetchOnChainAllowance(params) {
|
|
76
|
+
const { provider, erc20Contract, owner, spender, token, minPermissionDurationMs, deadlineUnixSeconds, permit2ContractAddress, requiredAmount, } = params;
|
|
81
77
|
// 2) On-chain ERC20 allowance to spender
|
|
82
78
|
const onChainAllowance = await erc20Contract.allowance(owner, spender);
|
|
79
|
+
if (requiredAmount != null && onChainAllowance >= requiredAmount) {
|
|
80
|
+
return {
|
|
81
|
+
onChainAllowance: onChainAllowance,
|
|
82
|
+
isRequiredAmountCovered: true,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (permit2ContractAddress == null) {
|
|
86
|
+
return {
|
|
87
|
+
isRequiredAmountCovered: false,
|
|
88
|
+
maxAllowed: onChainAllowance,
|
|
89
|
+
onChainAllowance,
|
|
90
|
+
onChainAllowanceToPermit2Contract: 0n,
|
|
91
|
+
onChainPermit2: 0n
|
|
92
|
+
};
|
|
93
|
+
}
|
|
83
94
|
// 3) ERC20 allowance to Permit2 contract (if zero, Permit2 approvals are not usable)
|
|
84
|
-
const onChainAllowanceToPermit2Contract = await erc20Contract.allowance(owner,
|
|
95
|
+
const onChainAllowanceToPermit2Contract = await erc20Contract.allowance(owner, permit2ContractAddress);
|
|
96
|
+
if (requiredAmount != null && onChainAllowanceToPermit2Contract <= requiredAmount) {
|
|
97
|
+
return {
|
|
98
|
+
onChainAllowance,
|
|
99
|
+
isRequiredAmountCovered: false,
|
|
100
|
+
onChainAllowanceToPermit2Contract,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const permit2Contract = abi_types_1.Permit2__factory.connect(permit2ContractAddress, provider);
|
|
85
104
|
// 4) On-chain Permit2 allowance amount (subject to expiry), only if token->Permit2 allowance > 0
|
|
86
105
|
let onChainPermit2 = 0n;
|
|
106
|
+
let permit2Nonce;
|
|
87
107
|
if (onChainAllowanceToPermit2Contract > 0n) {
|
|
88
108
|
const result = await permit2Contract.allowance(owner, token, spender);
|
|
89
109
|
// tuple: [amount, expiration, nonce]
|
|
90
110
|
const amount = result[0];
|
|
91
111
|
const expiration = result[1];
|
|
92
|
-
|
|
112
|
+
permit2Nonce = result[2];
|
|
113
|
+
if (expiration === 0n || (minPermissionDurationMs != null && isCloseToExpiry(expiration, minPermissionDurationMs)) ||
|
|
114
|
+
(deadlineUnixSeconds != null && expiration <= BigInt(deadlineUnixSeconds))) {
|
|
93
115
|
onChainPermit2 = 0n;
|
|
94
116
|
}
|
|
95
117
|
else {
|
|
@@ -97,6 +119,26 @@ async function calculateLiquidity(params) {
|
|
|
97
119
|
}
|
|
98
120
|
}
|
|
99
121
|
let maxAllowed = maxBigInt(onChainAllowance, onChainPermit2);
|
|
122
|
+
return {
|
|
123
|
+
onChainPermit2,
|
|
124
|
+
onChainAllowanceToPermit2Contract,
|
|
125
|
+
onChainAllowance,
|
|
126
|
+
isRequiredAmountCovered: requiredAmount != null ? maxAllowed >= requiredAmount : false,
|
|
127
|
+
maxAllowed,
|
|
128
|
+
permit2Nonce,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
async function calculateLiquidity(params) {
|
|
132
|
+
const { provider, owner, token, spender, permit2, minPermissionDurationMs } = params;
|
|
133
|
+
let backendPermission = params.permission ? { ...params.permission } : null;
|
|
134
|
+
// Contracts
|
|
135
|
+
const erc20Contract = abi_types_1.Erc20__factory.connect(token, provider);
|
|
136
|
+
// 1) On-chain balance
|
|
137
|
+
const balance = await erc20Contract.balanceOf(owner);
|
|
138
|
+
let { onChainAllowance, onChainAllowanceToPermit2Contract, onChainPermit2, maxAllowed } = await fetchOnChainAllowance({
|
|
139
|
+
provider, erc20Contract, owner, spender, permit2ContractAddress: permit2, token,
|
|
140
|
+
minPermissionDurationMs,
|
|
141
|
+
});
|
|
100
142
|
let permission = {};
|
|
101
143
|
// 5) Validate optional off-chain permission against on-chain state and expiry windows
|
|
102
144
|
if (backendPermission) {
|
|
@@ -132,3 +174,4 @@ async function calculateLiquidity(params) {
|
|
|
132
174
|
const spendable = minBigInt(maxAllowed, balance);
|
|
133
175
|
return new LiquidityBreakdown(spendable, balance, onChainAllowance, onChainPermit2, permission);
|
|
134
176
|
}
|
|
177
|
+
exports.default = calculateLiquidity;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SealClient, SealPermit2Contract, SealSealContract, SealToken } from "../codegen";
|
|
2
|
+
import { ContractRunner } from "ethers";
|
|
3
|
+
export declare enum ApprovalType {
|
|
4
|
+
Eip2612 = 1,// user signed an EIP-2612 permit
|
|
5
|
+
Permit2 = 2,// user used Uniswap Permit2
|
|
6
|
+
Erc20 = 3
|
|
7
|
+
}
|
|
8
|
+
export interface DomainInfo {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
verifyingContract: string;
|
|
12
|
+
chainId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CalculateRequiredPermitForOrderResponse {
|
|
15
|
+
ordersCount: bigint;
|
|
16
|
+
ordersRemaining: bigint;
|
|
17
|
+
permit?: {
|
|
18
|
+
approvalType: ApprovalType;
|
|
19
|
+
domainInfo?: DomainInfo;
|
|
20
|
+
allowance: bigint;
|
|
21
|
+
nonce?: bigint;
|
|
22
|
+
spender: string;
|
|
23
|
+
sigDeadline?: bigint;
|
|
24
|
+
expiration?: bigint;
|
|
25
|
+
};
|
|
26
|
+
permit2Contract?: SealPermit2Contract;
|
|
27
|
+
}
|
|
28
|
+
export declare function calculateRequiredPermitForOrder(params: {
|
|
29
|
+
provider: ContractRunner;
|
|
30
|
+
client: SealClient;
|
|
31
|
+
inputToken: SealToken;
|
|
32
|
+
owner: string;
|
|
33
|
+
amountIn: bigint;
|
|
34
|
+
sealContract?: SealSealContract;
|
|
35
|
+
expirationTimeSeconds: number;
|
|
36
|
+
}): Promise<CalculateRequiredPermitForOrderResponse>;
|