aftermath-ts-sdk 1.2.63 → 1.2.64-docs.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/README.md +61 -27
- package/dist/general/dynamicGas/dynamicGas.d.ts +34 -0
- package/dist/general/dynamicGas/dynamicGas.d.ts.map +1 -1
- package/dist/general/dynamicGas/dynamicGas.js +34 -0
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts +25 -0
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +1 -1
- package/dist/general/prices/prices.d.ts +73 -0
- package/dist/general/prices/prices.d.ts.map +1 -1
- package/dist/general/prices/prices.js +73 -0
- package/dist/general/providers/aftermath.d.ts +106 -25
- package/dist/general/providers/aftermath.d.ts.map +1 -1
- package/dist/general/providers/aftermath.js +108 -27
- package/dist/general/providers/aftermathApi.d.ts +127 -8
- package/dist/general/providers/aftermathApi.d.ts.map +1 -1
- package/dist/general/providers/aftermathApi.js +132 -12
- package/dist/general/types/castingTypes.d.ts +0 -7
- package/dist/general/types/castingTypes.d.ts.map +1 -1
- package/dist/general/types/castingTypes.js +6 -0
- package/dist/general/types/generalTypes.d.ts +228 -7
- package/dist/general/types/generalTypes.d.ts.map +1 -1
- package/dist/general/types/suiTypes.d.ts +0 -16
- package/dist/general/types/suiTypes.d.ts.map +1 -1
- package/dist/general/types/suiTypes.js +3 -25
- package/dist/general/utils/casting.d.ts +159 -3
- package/dist/general/utils/casting.d.ts.map +1 -1
- package/dist/general/utils/casting.js +162 -16
- package/dist/general/utils/fixedUtils.d.ts +89 -2
- package/dist/general/utils/fixedUtils.d.ts.map +1 -1
- package/dist/general/utils/fixedUtils.js +81 -4
- package/dist/general/utils/helpers.d.ts +320 -9
- package/dist/general/utils/helpers.d.ts.map +1 -1
- package/dist/general/utils/helpers.js +350 -89
- package/dist/general/utils/iFixedUtils.d.ts +64 -0
- package/dist/general/utils/iFixedUtils.d.ts.map +1 -1
- package/dist/general/utils/iFixedUtils.js +64 -0
- package/dist/general/wallet/wallet.d.ts +75 -0
- package/dist/general/wallet/wallet.d.ts.map +1 -1
- package/dist/general/wallet/wallet.js +75 -5
- package/dist/packages/auth/auth.d.ts +113 -0
- package/dist/packages/auth/auth.d.ts.map +1 -1
- package/dist/packages/auth/auth.js +129 -15
- package/dist/packages/auth/authTypes.d.ts +66 -0
- package/dist/packages/auth/authTypes.d.ts.map +1 -1
- package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
- package/dist/packages/coin/api/coinApi.js +28 -20
- package/dist/packages/coin/coin.d.ts +250 -0
- package/dist/packages/coin/coin.d.ts.map +1 -1
- package/dist/packages/coin/coin.js +238 -14
- package/dist/packages/coin/coinTypes.d.ts +93 -0
- package/dist/packages/coin/coinTypes.d.ts.map +1 -1
- package/dist/packages/dca/dca.d.ts +124 -35
- package/dist/packages/dca/dca.d.ts.map +1 -1
- package/dist/packages/dca/dca.js +127 -37
- package/dist/packages/dca/dcaTypes.d.ts +213 -28
- package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
- package/dist/packages/farms/farms.d.ts +184 -1
- package/dist/packages/farms/farms.d.ts.map +1 -1
- package/dist/packages/farms/farms.js +185 -11
- package/dist/packages/farms/farmsStakedPosition.d.ts +140 -6
- package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -1
- package/dist/packages/farms/farmsStakedPosition.js +189 -144
- package/dist/packages/farms/farmsStakingPool.d.ts +161 -1
- package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -1
- package/dist/packages/farms/farmsStakingPool.js +176 -70
- package/dist/packages/farms/farmsTypes.d.ts +283 -2
- package/dist/packages/farms/farmsTypes.d.ts.map +1 -1
- package/dist/packages/farms/farmsTypes.js +18 -0
- package/dist/packages/limitOrders/limitOrders.d.ts +108 -21
- package/dist/packages/limitOrders/limitOrders.d.ts.map +1 -1
- package/dist/packages/limitOrders/limitOrders.js +110 -22
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts +142 -0
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +1 -1
- package/dist/packages/multisig/multisig.d.ts +33 -4
- package/dist/packages/multisig/multisig.d.ts.map +1 -1
- package/dist/packages/multisig/multisig.js +33 -4
- package/dist/packages/multisig/multisigTypes.d.ts +17 -0
- package/dist/packages/multisig/multisigTypes.d.ts.map +1 -1
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
- package/dist/packages/pools/pool.d.ts +327 -85
- package/dist/packages/pools/pool.d.ts.map +1 -1
- package/dist/packages/pools/pool.js +333 -91
- package/dist/packages/pools/pools.d.ts +299 -37
- package/dist/packages/pools/pools.d.ts.map +1 -1
- package/dist/packages/pools/pools.js +306 -52
- package/dist/packages/pools/poolsTypes.d.ts +273 -8
- package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
- package/dist/packages/referralVault/referralVault.d.ts +37 -0
- package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
- package/dist/packages/referralVault/referralVault.js +37 -0
- package/dist/packages/router/router.d.ts +213 -17
- package/dist/packages/router/router.d.ts.map +1 -1
- package/dist/packages/router/router.js +214 -18
- package/dist/packages/router/routerTypes.d.ts +198 -14
- package/dist/packages/router/routerTypes.d.ts.map +1 -1
- package/dist/packages/staking/staking.d.ts +301 -43
- package/dist/packages/staking/staking.d.ts.map +1 -1
- package/dist/packages/staking/staking.js +308 -51
- package/dist/packages/staking/stakingTypes.d.ts +426 -6
- package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
- package/dist/packages/staking/stakingTypes.js +19 -0
- package/dist/packages/sui/sui.d.ts +39 -0
- package/dist/packages/sui/sui.d.ts.map +1 -1
- package/dist/packages/sui/sui.js +39 -0
- package/dist/packages/userData/userData.d.ts +66 -12
- package/dist/packages/userData/userData.d.ts.map +1 -1
- package/dist/packages/userData/userData.js +66 -12
- package/dist/packages/userData/userDataTypes.d.ts +19 -0
- package/dist/packages/userData/userDataTypes.d.ts.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/package.json +1 -1
- package/dist/general/historicalData/historicalData.d.ts +0 -15
- package/dist/general/historicalData/historicalData.d.ts.map +0 -1
- package/dist/general/historicalData/historicalData.js +0 -45
- package/dist/general/historicalData/historicalDataTypes.d.ts +0 -10
- package/dist/general/historicalData/historicalDataTypes.d.ts.map +0 -1
- package/dist/general/historicalData/historicalDataTypes.js +0 -2
|
@@ -1,45 +1,125 @@
|
|
|
1
|
-
import { CallerConfig, ObjectId } from "../../types";
|
|
1
|
+
import { CallerConfig, ObjectId, SuiAddress } from "../../types";
|
|
2
2
|
import { Caller } from "../../general/utils/caller";
|
|
3
|
-
import { SuiAddress } from "../../types";
|
|
4
3
|
import { ApiLimitOrdersCreateOrderTransactionBody, ApiLimitOrdersCancelOrderTransactionBody, LimitOrderObject, ApiLimitOrdersActiveOrdersOwnedBody } from "./limitOrdersTypes";
|
|
5
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
|
+
/**
|
|
6
|
+
* The `LimitOrders` class manages creation, cancellation, and querying of
|
|
7
|
+
* limit orders on the Aftermath platform. Limit orders allow you to buy or
|
|
8
|
+
* sell at a specified price, giving more control over your trades compared
|
|
9
|
+
* to market execution.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
14
|
+
* await afSdk.init(); // initialize provider
|
|
15
|
+
*
|
|
16
|
+
* const limitOrders = afSdk.LimitOrders();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
6
19
|
export declare class LimitOrders extends Caller {
|
|
20
|
+
/**
|
|
21
|
+
* Static configuration constants, including a default gas amount for
|
|
22
|
+
* limit order transactions (50 SUI).
|
|
23
|
+
*/
|
|
7
24
|
static readonly constants: {
|
|
25
|
+
/**
|
|
26
|
+
* The default gas budget for limit orders. This may be subject to change.
|
|
27
|
+
*/
|
|
8
28
|
gasAmount: bigint;
|
|
9
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new `LimitOrders` instance for interacting with limit order functionality
|
|
32
|
+
* on Aftermath.
|
|
33
|
+
*
|
|
34
|
+
* @param config - Optional configuration, including network and access token.
|
|
35
|
+
*/
|
|
10
36
|
constructor(config?: CallerConfig);
|
|
11
37
|
/**
|
|
12
|
-
* Fetches the
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
38
|
+
* Fetches the list of **active** limit orders for a given user. The user must
|
|
39
|
+
* provide a signature for identification.
|
|
40
|
+
*
|
|
41
|
+
* @param inputs - Contains the `walletAddress`, as well as `bytes` and `signature` if needed for auth.
|
|
42
|
+
* @returns A promise resolving to an array of `LimitOrderObject`, representing the active orders.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const activeOrders = await limitOrders.getActiveLimitOrders({
|
|
47
|
+
* walletAddress: "0x<address>",
|
|
48
|
+
* bytes: "0x<signed_bytes>",
|
|
49
|
+
* signature: "0x<signature>"
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
16
52
|
*/
|
|
17
53
|
getActiveLimitOrders(inputs: ApiLimitOrdersActiveOrdersOwnedBody): Promise<LimitOrderObject[]>;
|
|
18
54
|
/**
|
|
19
|
-
* Fetches the
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
55
|
+
* Fetches the list of **past** limit orders for a given user (e.g., completed, canceled, or expired).
|
|
56
|
+
*
|
|
57
|
+
* @param inputs - An object containing the `walletAddress`.
|
|
58
|
+
* @returns A promise resolving to an array of `LimitOrderObject` representing past orders.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const pastOrders = await limitOrders.getPastLimitOrders({
|
|
63
|
+
* walletAddress: "0x<address>",
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
23
66
|
*/
|
|
24
67
|
getPastLimitOrders(inputs: {
|
|
25
68
|
walletAddress: SuiAddress;
|
|
26
69
|
}): Promise<LimitOrderObject[]>;
|
|
27
70
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
71
|
+
* Constructs a limit order creation transaction on the Aftermath API, returning a `Transaction`
|
|
72
|
+
* object that can be signed and submitted to the network.
|
|
73
|
+
*
|
|
74
|
+
* @param inputs - The limit order details, including coin types, amounts, expiry, etc.
|
|
75
|
+
* @returns A promise resolving to a `Transaction` that can be locally signed and executed.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* const tx = await limitOrders.getCreateLimitOrderTx({
|
|
80
|
+
* walletAddress: "0x<address>",
|
|
81
|
+
* allocateCoinType: "0x<coin>",
|
|
82
|
+
* allocateCoinAmount: BigInt(1000),
|
|
83
|
+
* buyCoinType: "0x<other_coin>",
|
|
84
|
+
* expiryDurationMs: 3600000, // 1 hour
|
|
85
|
+
* outputToInputExchangeRate: 0.5,
|
|
86
|
+
* });
|
|
87
|
+
* // sign and execute the transaction
|
|
88
|
+
* ```
|
|
31
89
|
*/
|
|
32
90
|
getCreateLimitOrderTx(inputs: ApiLimitOrdersCreateOrderTransactionBody): Promise<Transaction>;
|
|
33
91
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
92
|
+
* Cancels an existing limit order by sending a request to the Aftermath API
|
|
93
|
+
* with the user's signed cancellation message.
|
|
94
|
+
*
|
|
95
|
+
* @param inputs - Contains the user's `walletAddress`, plus `bytes` and `signature`.
|
|
96
|
+
* @returns A boolean indicating whether the cancellation was successful.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const success = await limitOrders.cancelLimitOrder({
|
|
101
|
+
* walletAddress: "0x<address>",
|
|
102
|
+
* bytes: "0x<signed_bytes>",
|
|
103
|
+
* signature: "0x<signature>",
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
37
106
|
*/
|
|
38
107
|
cancelLimitOrder(inputs: ApiLimitOrdersCancelOrderTransactionBody): Promise<boolean>;
|
|
39
108
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
109
|
+
* Generates the JSON message needed to cancel one or more limit orders. The user
|
|
110
|
+
* signs this message (converted to bytes), and the resulting signature is passed
|
|
111
|
+
* to `cancelLimitOrder`.
|
|
112
|
+
*
|
|
113
|
+
* @param inputs - Object with `orderIds`, an array of order object IDs to cancel.
|
|
114
|
+
* @returns A JSON structure with the action and order IDs to be canceled.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const msg = limitOrders.cancelLimitOrdersMessageToSign({
|
|
119
|
+
* orderIds: ["0x<order1>", "0x<order2>"]
|
|
120
|
+
* });
|
|
121
|
+
* // user signs this JSON
|
|
122
|
+
* ```
|
|
43
123
|
*/
|
|
44
124
|
cancelLimitOrdersMessageToSign(inputs: {
|
|
45
125
|
orderIds: ObjectId[];
|
|
@@ -48,8 +128,15 @@ export declare class LimitOrders extends Caller {
|
|
|
48
128
|
order_object_ids: string[];
|
|
49
129
|
};
|
|
50
130
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
131
|
+
* Retrieves the minimum allowable order size (in USD) for limit orders on Aftermath.
|
|
132
|
+
*
|
|
133
|
+
* @returns A promise resolving to a `number` (USD value) or `undefined` if not configured.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* const minSize = await limitOrders.getMinOrderSizeUsd();
|
|
138
|
+
* console.log("Minimum order size in USD:", minSize);
|
|
139
|
+
* ```
|
|
53
140
|
*/
|
|
54
141
|
getMinOrderSizeUsd(): Promise<number | undefined>;
|
|
55
142
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitOrders.d.ts","sourceRoot":"","sources":["../../../src/packages/limitOrders/limitOrders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAY,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"limitOrders.d.ts","sourceRoot":"","sources":["../../../src/packages/limitOrders/limitOrders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAY,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAEN,wCAAwC,EACxC,wCAAwC,EACxC,gBAAgB,EAChB,mCAAmC,EACnC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAY,SAAQ,MAAM;IAKtC;;;OAGG;IACH,gBAAuB,SAAS;QAC/B;;WAEG;;MAEF;IAMF;;;;;OAKG;gBACS,MAAM,CAAC,EAAE,YAAY;IAQjC;;;;;;;;;;;;;;;OAeG;IACU,oBAAoB,CAChC,MAAM,EAAE,mCAAmC;IAQ5C;;;;;;;;;;;;OAYG;IACU,kBAAkB,CAAC,MAAM,EAAE;QAAE,aAAa,EAAE,UAAU,CAAA;KAAE;IAWrE;;;;;;;;;;;;;;;;;;;OAmBG;IACU,qBAAqB,CACjC,MAAM,EAAE,wCAAwC,GAC9C,OAAO,CAAC,WAAW,CAAC;IAOvB;;;;;;;;;;;;;;;OAeG;IACU,gBAAgB,CAC5B,MAAM,EAAE,wCAAwC,GAC9C,OAAO,CAAC,OAAO,CAAC;IAWnB;;;;;;;;;;;;;;;OAeG;IACI,8BAA8B,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;KAAE,GAAG;QACxE,MAAM,EAAE,MAAM,CAAC;QACf,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC3B;IAWD;;;;;;;;;;OAUG;IACU,kBAAkB;CAG/B"}
|
|
@@ -11,10 +11,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.LimitOrders = void 0;
|
|
13
13
|
const caller_1 = require("../../general/utils/caller");
|
|
14
|
+
/**
|
|
15
|
+
* The `LimitOrders` class manages creation, cancellation, and querying of
|
|
16
|
+
* limit orders on the Aftermath platform. Limit orders allow you to buy or
|
|
17
|
+
* sell at a specified price, giving more control over your trades compared
|
|
18
|
+
* to market execution.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
23
|
+
* await afSdk.init(); // initialize provider
|
|
24
|
+
*
|
|
25
|
+
* const limitOrders = afSdk.LimitOrders();
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
14
28
|
class LimitOrders extends caller_1.Caller {
|
|
15
29
|
// =========================================================================
|
|
16
30
|
// Constructor
|
|
17
31
|
// =========================================================================
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new `LimitOrders` instance for interacting with limit order functionality
|
|
34
|
+
* on Aftermath.
|
|
35
|
+
*
|
|
36
|
+
* @param config - Optional configuration, including network and access token.
|
|
37
|
+
*/
|
|
18
38
|
constructor(config) {
|
|
19
39
|
super(config, "limit-orders");
|
|
20
40
|
}
|
|
@@ -22,10 +42,20 @@ class LimitOrders extends caller_1.Caller {
|
|
|
22
42
|
// Class Objects
|
|
23
43
|
// =========================================================================
|
|
24
44
|
/**
|
|
25
|
-
* Fetches the
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
45
|
+
* Fetches the list of **active** limit orders for a given user. The user must
|
|
46
|
+
* provide a signature for identification.
|
|
47
|
+
*
|
|
48
|
+
* @param inputs - Contains the `walletAddress`, as well as `bytes` and `signature` if needed for auth.
|
|
49
|
+
* @returns A promise resolving to an array of `LimitOrderObject`, representing the active orders.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const activeOrders = await limitOrders.getActiveLimitOrders({
|
|
54
|
+
* walletAddress: "0x<address>",
|
|
55
|
+
* bytes: "0x<signed_bytes>",
|
|
56
|
+
* signature: "0x<signature>"
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
29
59
|
*/
|
|
30
60
|
getActiveLimitOrders(inputs) {
|
|
31
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -33,10 +63,17 @@ class LimitOrders extends caller_1.Caller {
|
|
|
33
63
|
});
|
|
34
64
|
}
|
|
35
65
|
/**
|
|
36
|
-
* Fetches the
|
|
37
|
-
*
|
|
38
|
-
* @param
|
|
39
|
-
* @returns
|
|
66
|
+
* Fetches the list of **past** limit orders for a given user (e.g., completed, canceled, or expired).
|
|
67
|
+
*
|
|
68
|
+
* @param inputs - An object containing the `walletAddress`.
|
|
69
|
+
* @returns A promise resolving to an array of `LimitOrderObject` representing past orders.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const pastOrders = await limitOrders.getPastLimitOrders({
|
|
74
|
+
* walletAddress: "0x<address>",
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
40
77
|
*/
|
|
41
78
|
getPastLimitOrders(inputs) {
|
|
42
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -44,12 +81,27 @@ class LimitOrders extends caller_1.Caller {
|
|
|
44
81
|
});
|
|
45
82
|
}
|
|
46
83
|
// =========================================================================
|
|
47
|
-
//
|
|
84
|
+
// Transactions
|
|
48
85
|
// =========================================================================
|
|
49
86
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
87
|
+
* Constructs a limit order creation transaction on the Aftermath API, returning a `Transaction`
|
|
88
|
+
* object that can be signed and submitted to the network.
|
|
89
|
+
*
|
|
90
|
+
* @param inputs - The limit order details, including coin types, amounts, expiry, etc.
|
|
91
|
+
* @returns A promise resolving to a `Transaction` that can be locally signed and executed.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const tx = await limitOrders.getCreateLimitOrderTx({
|
|
96
|
+
* walletAddress: "0x<address>",
|
|
97
|
+
* allocateCoinType: "0x<coin>",
|
|
98
|
+
* allocateCoinAmount: BigInt(1000),
|
|
99
|
+
* buyCoinType: "0x<other_coin>",
|
|
100
|
+
* expiryDurationMs: 3600000, // 1 hour
|
|
101
|
+
* outputToInputExchangeRate: 0.5,
|
|
102
|
+
* });
|
|
103
|
+
* // sign and execute the transaction
|
|
104
|
+
* ```
|
|
53
105
|
*/
|
|
54
106
|
getCreateLimitOrderTx(inputs) {
|
|
55
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -57,9 +109,20 @@ class LimitOrders extends caller_1.Caller {
|
|
|
57
109
|
});
|
|
58
110
|
}
|
|
59
111
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
112
|
+
* Cancels an existing limit order by sending a request to the Aftermath API
|
|
113
|
+
* with the user's signed cancellation message.
|
|
114
|
+
*
|
|
115
|
+
* @param inputs - Contains the user's `walletAddress`, plus `bytes` and `signature`.
|
|
116
|
+
* @returns A boolean indicating whether the cancellation was successful.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const success = await limitOrders.cancelLimitOrder({
|
|
121
|
+
* walletAddress: "0x<address>",
|
|
122
|
+
* bytes: "0x<signed_bytes>",
|
|
123
|
+
* signature: "0x<signature>",
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
63
126
|
*/
|
|
64
127
|
cancelLimitOrder(inputs) {
|
|
65
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -67,12 +130,23 @@ class LimitOrders extends caller_1.Caller {
|
|
|
67
130
|
});
|
|
68
131
|
}
|
|
69
132
|
// =========================================================================
|
|
70
|
-
//
|
|
133
|
+
// Interactions
|
|
71
134
|
// =========================================================================
|
|
72
135
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
136
|
+
* Generates the JSON message needed to cancel one or more limit orders. The user
|
|
137
|
+
* signs this message (converted to bytes), and the resulting signature is passed
|
|
138
|
+
* to `cancelLimitOrder`.
|
|
139
|
+
*
|
|
140
|
+
* @param inputs - Object with `orderIds`, an array of order object IDs to cancel.
|
|
141
|
+
* @returns A JSON structure with the action and order IDs to be canceled.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
145
|
+
* const msg = limitOrders.cancelLimitOrdersMessageToSign({
|
|
146
|
+
* orderIds: ["0x<order1>", "0x<order2>"]
|
|
147
|
+
* });
|
|
148
|
+
* // user signs this JSON
|
|
149
|
+
* ```
|
|
76
150
|
*/
|
|
77
151
|
cancelLimitOrdersMessageToSign(inputs) {
|
|
78
152
|
return {
|
|
@@ -81,11 +155,18 @@ class LimitOrders extends caller_1.Caller {
|
|
|
81
155
|
};
|
|
82
156
|
}
|
|
83
157
|
// =========================================================================
|
|
84
|
-
//
|
|
158
|
+
// Configuration
|
|
85
159
|
// =========================================================================
|
|
86
160
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
161
|
+
* Retrieves the minimum allowable order size (in USD) for limit orders on Aftermath.
|
|
162
|
+
*
|
|
163
|
+
* @returns A promise resolving to a `number` (USD value) or `undefined` if not configured.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const minSize = await limitOrders.getMinOrderSizeUsd();
|
|
168
|
+
* console.log("Minimum order size in USD:", minSize);
|
|
169
|
+
* ```
|
|
89
170
|
*/
|
|
90
171
|
getMinOrderSizeUsd() {
|
|
91
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -97,6 +178,13 @@ exports.LimitOrders = LimitOrders;
|
|
|
97
178
|
// =========================================================================
|
|
98
179
|
// Constants
|
|
99
180
|
// =========================================================================
|
|
181
|
+
/**
|
|
182
|
+
* Static configuration constants, including a default gas amount for
|
|
183
|
+
* limit order transactions (50 SUI).
|
|
184
|
+
*/
|
|
100
185
|
LimitOrders.constants = {
|
|
186
|
+
/**
|
|
187
|
+
* The default gas budget for limit orders. This may be subject to change.
|
|
188
|
+
*/
|
|
101
189
|
gasAmount: BigInt(50000000),
|
|
102
190
|
};
|
|
@@ -1,69 +1,211 @@
|
|
|
1
1
|
import { ObjectId, SuiAddress } from "../../types";
|
|
2
2
|
import { CoinType } from "../coin/coinTypes";
|
|
3
3
|
import { Balance, Timestamp, TransactionDigest } from "../../general/types/generalTypes";
|
|
4
|
+
/**
|
|
5
|
+
* Describes an optional integrator fee structure for advanced usage,
|
|
6
|
+
* allowing a portion of limit orders to be allocated to a third party.
|
|
7
|
+
*/
|
|
4
8
|
export interface LimitOrdersIntegratorFeeData {
|
|
9
|
+
/**
|
|
10
|
+
* The integrator fee percentage in basis points (bps), e.g., 100 => 1%.
|
|
11
|
+
*/
|
|
5
12
|
feeBps: number;
|
|
13
|
+
/**
|
|
14
|
+
* The recipient address for fee collection.
|
|
15
|
+
*/
|
|
6
16
|
feeRecipient: SuiAddress;
|
|
7
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Defines the body required to create a new limit order transaction. This includes
|
|
20
|
+
* coin types, amounts, expiry settings, and optional integrator fees.
|
|
21
|
+
*/
|
|
8
22
|
export interface ApiLimitOrdersCreateOrderTransactionBody {
|
|
23
|
+
/**
|
|
24
|
+
* The user address creating the limit order.
|
|
25
|
+
*/
|
|
9
26
|
walletAddress: SuiAddress;
|
|
27
|
+
/**
|
|
28
|
+
* The coin type to be allocated/sold in the order.
|
|
29
|
+
*/
|
|
10
30
|
allocateCoinType: CoinType;
|
|
31
|
+
/**
|
|
32
|
+
* The total amount of the allocateCoin to be reserved for this order.
|
|
33
|
+
*/
|
|
11
34
|
allocateCoinAmount: Balance;
|
|
35
|
+
/**
|
|
36
|
+
* The coin type to be purchased when price conditions are met.
|
|
37
|
+
*/
|
|
12
38
|
buyCoinType: CoinType;
|
|
39
|
+
/**
|
|
40
|
+
* Optionally specify a custom recipient of the purchased coin, defaulting to `walletAddress`.
|
|
41
|
+
*/
|
|
13
42
|
customRecipient?: SuiAddress;
|
|
43
|
+
/**
|
|
44
|
+
* The duration (in ms) after which the limit order expires and becomes invalid.
|
|
45
|
+
* If `0`, there's effectively no set expiry.
|
|
46
|
+
*/
|
|
14
47
|
expiryDurationMs: number;
|
|
48
|
+
/**
|
|
49
|
+
* Indicates whether the transaction is sponsored, potentially reducing user gas fees.
|
|
50
|
+
*/
|
|
15
51
|
isSponsoredTx?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Optional integrator fee details for advanced usage.
|
|
54
|
+
*/
|
|
16
55
|
integratorFee?: LimitOrdersIntegratorFeeData;
|
|
56
|
+
/**
|
|
57
|
+
* The "take-profit" exchange rate from `buyCoinType` to `allocateCoinType`.
|
|
58
|
+
* For example, if `outputToInputExchangeRate` is 0.5, it means 1 buyCoin can be sold for 0.5 allocateCoin.
|
|
59
|
+
*/
|
|
17
60
|
outputToInputExchangeRate: number;
|
|
61
|
+
/**
|
|
62
|
+
* Optional "stop-loss" exchange rate. If the market moves such that the trade
|
|
63
|
+
* would invert beyond this rate, the order might close early or fail, depending on logic.
|
|
64
|
+
*/
|
|
18
65
|
outputToInputStopLossExchangeRate?: number;
|
|
19
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Additional body for sub-orders if using a multi-tier approach (ladders).
|
|
69
|
+
*/
|
|
20
70
|
export interface ApiLimitOrdersSubOrdersBody {
|
|
71
|
+
/**
|
|
72
|
+
* The order price (e.g., an exchange rate or threshold).
|
|
73
|
+
*/
|
|
21
74
|
orderPrice: Balance;
|
|
75
|
+
/**
|
|
76
|
+
* The number of partial orders to create at this price level.
|
|
77
|
+
*/
|
|
22
78
|
ordersAmount: number;
|
|
23
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Defines a single "ladder" rung, specifying how much to trade at a certain price.
|
|
82
|
+
*/
|
|
24
83
|
export interface ApiLimitLaddersOrdersBody {
|
|
84
|
+
/**
|
|
85
|
+
* The specific price (exchange rate) for this rung.
|
|
86
|
+
*/
|
|
25
87
|
price: Balance;
|
|
88
|
+
/**
|
|
89
|
+
* The total quantity/amount to trade if the price is reached.
|
|
90
|
+
*/
|
|
26
91
|
quantity: Balance;
|
|
27
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Body required to cancel an existing limit order, typically including the
|
|
95
|
+
* user's signature of a JSON message referencing order IDs.
|
|
96
|
+
*/
|
|
28
97
|
export interface ApiLimitOrdersCancelOrderTransactionBody {
|
|
98
|
+
/**
|
|
99
|
+
* The Sui address of the user who owns the order(s).
|
|
100
|
+
*/
|
|
29
101
|
walletAddress: SuiAddress;
|
|
102
|
+
/**
|
|
103
|
+
* The signed bytes of the cancellation message.
|
|
104
|
+
*/
|
|
30
105
|
bytes: string;
|
|
106
|
+
/**
|
|
107
|
+
* The signature over those bytes, verifying user intent.
|
|
108
|
+
*/
|
|
31
109
|
signature: string;
|
|
32
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Enumerates all possible statuses for a limit order on Aftermath.
|
|
113
|
+
*/
|
|
33
114
|
export type LimitOrdersOrderStatus = "Active" | "Canceled" | "Failed" | "Filled" | "Expired" | "StopLossTriggered";
|
|
115
|
+
/**
|
|
116
|
+
* Represents the on-chain data structure for a single limit order, including
|
|
117
|
+
* allocated coin amounts, buy coin details, creation/finalization times, etc.
|
|
118
|
+
*/
|
|
34
119
|
export interface LimitOrderObject {
|
|
120
|
+
/**
|
|
121
|
+
* The on-chain object ID referencing this limit order.
|
|
122
|
+
*/
|
|
35
123
|
objectId: ObjectId;
|
|
124
|
+
/**
|
|
125
|
+
* The coin & amount allocated for potential trading.
|
|
126
|
+
*/
|
|
36
127
|
allocatedCoin: {
|
|
37
128
|
coin: CoinType;
|
|
38
129
|
amount: Balance;
|
|
39
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* The coin & amount to be acquired if/when the order conditions are met.
|
|
133
|
+
*/
|
|
40
134
|
buyCoin: {
|
|
41
135
|
coin: CoinType;
|
|
42
136
|
amount: Balance;
|
|
43
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* Tracks how much of the allocated coin has actually been used (sold).
|
|
140
|
+
*/
|
|
44
141
|
currentAmountSold: Balance;
|
|
142
|
+
/**
|
|
143
|
+
* Tracks how much of the buy coin has actually been purchased.
|
|
144
|
+
*/
|
|
45
145
|
currentAmountBought: Balance;
|
|
146
|
+
/**
|
|
147
|
+
* The address that will receive the bought coin, often the same as `walletAddress`.
|
|
148
|
+
*/
|
|
46
149
|
recipient: SuiAddress;
|
|
150
|
+
/**
|
|
151
|
+
* Contains timestamps and transaction references for order creation.
|
|
152
|
+
*/
|
|
47
153
|
created: {
|
|
48
154
|
timestamp: Timestamp;
|
|
49
155
|
txnDigest: TransactionDigest;
|
|
50
156
|
};
|
|
157
|
+
/**
|
|
158
|
+
* If the order has finished, indicates when and via which transaction it concluded.
|
|
159
|
+
*/
|
|
51
160
|
finished?: {
|
|
52
161
|
timestamp: Timestamp;
|
|
53
162
|
txnDigest: TransactionDigest;
|
|
54
163
|
};
|
|
164
|
+
/**
|
|
165
|
+
* The UNIX timestamp (ms) after which the order is considered expired.
|
|
166
|
+
*/
|
|
55
167
|
expiryTimestamp: Timestamp;
|
|
168
|
+
/**
|
|
169
|
+
* The current status of the order (Active, Canceled, etc.).
|
|
170
|
+
*/
|
|
56
171
|
status: LimitOrdersOrderStatus;
|
|
172
|
+
/**
|
|
173
|
+
* If the order ended or failed with an error, this might contain a reason or message.
|
|
174
|
+
*/
|
|
57
175
|
error?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Optional integrator fee data for advanced usage.
|
|
178
|
+
*/
|
|
58
179
|
integratorFee?: LimitOrdersIntegratorFeeData;
|
|
180
|
+
/**
|
|
181
|
+
* Optional stop-loss exchange rate; if triggered, the order might end or convert differently.
|
|
182
|
+
*/
|
|
59
183
|
outputToInputStopLossExchangeRate?: number;
|
|
60
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Body for fetching past (completed, canceled, expired, etc.) limit orders of a user.
|
|
187
|
+
*/
|
|
61
188
|
export interface ApiLimitOrdersPastOrdersOwnedBody {
|
|
189
|
+
/**
|
|
190
|
+
* The Sui address of the user.
|
|
191
|
+
*/
|
|
62
192
|
walletAddress: SuiAddress;
|
|
63
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Body for fetching active limit orders of a user, requiring user signature data for identification.
|
|
196
|
+
*/
|
|
64
197
|
export interface ApiLimitOrdersActiveOrdersOwnedBody {
|
|
198
|
+
/**
|
|
199
|
+
* The Sui address of the user.
|
|
200
|
+
*/
|
|
65
201
|
walletAddress: SuiAddress;
|
|
202
|
+
/**
|
|
203
|
+
* Signed bytes of a message verifying user identity.
|
|
204
|
+
*/
|
|
66
205
|
bytes: string;
|
|
206
|
+
/**
|
|
207
|
+
* Signature over the `bytes`.
|
|
208
|
+
*/
|
|
67
209
|
signature: string;
|
|
68
210
|
}
|
|
69
211
|
//# sourceMappingURL=limitOrdersTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitOrdersTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/limitOrders/limitOrdersTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EACN,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,MAAM,kCAAkC,CAAC;AAM1C,MAAM,WAAW,4BAA4B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,UAAU,CAAC;CACzB;AAMD,MAAM,WAAW,wCAAwC;IACxD,aAAa,EAAE,UAAU,CAAC;IAC1B,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,QAAQ,CAAC;IACtB,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,4BAA4B,CAAC;IAC7C,yBAAyB,EAAE,MAAM,CAAC;IAClC,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC3C;AAED,MAAM,WAAW,2BAA2B;IAC3C,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACrB;AAMD,MAAM,WAAW,yBAAyB;IACzC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CAClB;AAMD,MAAM,WAAW,wCAAwC;IACxD,aAAa,EAAE,UAAU,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CAClB;AAMD,MAAM,MAAM,sBAAsB,GAC/B,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,mBAAmB,CAAC;AAEvB,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE;QACd,IAAI,EAAE,QAAQ,CAAC;QACf,MAAM,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,OAAO,EAAE;QACR,IAAI,EAAE,QAAQ,CAAC;QACf,MAAM,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,iBAAiB,EAAE,OAAO,CAAC;IAC3B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE;QACR,SAAS,EAAE,SAAS,CAAC;QACrB,SAAS,EAAE,iBAAiB,CAAC;KAC7B,CAAC;IACF,QAAQ,CAAC,EAAE;QACV,SAAS,EAAE,SAAS,CAAC;QACrB,SAAS,EAAE,iBAAiB,CAAC;KAC7B,CAAC;IACF,eAAe,EAAE,SAAS,CAAC;IAC3B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,4BAA4B,CAAC;IAC7C,iCAAiC,CAAC,EAAE,MAAM,CAAC;CAC3C;AAMD,MAAM,WAAW,iCAAiC;IACjD,aAAa,EAAE,UAAU,CAAC;CAC1B;AAED,MAAM,WAAW,mCAAmC;IACnD,aAAa,EAAE,UAAU,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CAClB"}
|
|
1
|
+
{"version":3,"file":"limitOrdersTypes.d.ts","sourceRoot":"","sources":["../../../src/packages/limitOrders/limitOrdersTypes.ts"],"names":[],"mappings":"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"}
|
|
@@ -2,16 +2,45 @@ import { Caller } from "../../general/utils/caller";
|
|
|
2
2
|
import { CallerConfig } from "../../types";
|
|
3
3
|
import { AftermathApi } from "../../general/providers";
|
|
4
4
|
import { ApiMultisigUserBody } from "./multisigTypes";
|
|
5
|
+
/**
|
|
6
|
+
* The `Multisig` class provides methods to interact with multisig-related functionality,
|
|
7
|
+
* such as retrieving a multisig address and associated public key for a user.
|
|
8
|
+
*/
|
|
5
9
|
export declare class Multisig extends Caller {
|
|
6
10
|
private readonly Provider?;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new instance of `Multisig`.
|
|
13
|
+
*
|
|
14
|
+
* @param config - Optional configuration for the `Caller`, including network and access token.
|
|
15
|
+
* @param Provider - An optional instance of `AftermathApi` to build or fetch multisig data.
|
|
16
|
+
*/
|
|
7
17
|
constructor(config?: CallerConfig, Provider?: AftermathApi | undefined);
|
|
8
18
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
19
|
+
* Retrieves a multisig address and corresponding public key for a user based on their
|
|
20
|
+
* provided single public key.
|
|
21
|
+
*
|
|
22
|
+
* @param inputs - An object implementing `ApiMultisigUserBody`, containing the user's public key as a `Uint8Array`.
|
|
23
|
+
* @returns A promise that resolves to an object containing both the multisig address and its public key.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
*
|
|
28
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
29
|
+
* await afSdk.init(); // initialize provider
|
|
30
|
+
*
|
|
31
|
+
* const multisig = afSdk.Multisig();
|
|
32
|
+
*
|
|
33
|
+
* const data = await multisig.getMultisigForUser({
|
|
34
|
+
* userPublicKey: myPublicKeyBytes
|
|
35
|
+
* });
|
|
36
|
+
* console.log(data.address, data.publicKey);
|
|
37
|
+
* ```
|
|
13
38
|
*/
|
|
14
39
|
getMultisigForUser(inputs: ApiMultisigUserBody): import("./multisigTypes").MultisigData;
|
|
40
|
+
/**
|
|
41
|
+
* Internal helper to get the configured `Multisig` provider from `AftermathApi`.
|
|
42
|
+
* Throws an error if the provider is not available.
|
|
43
|
+
*/
|
|
15
44
|
private useProvider;
|
|
16
45
|
}
|
|
17
46
|
//# sourceMappingURL=multisig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multisig.d.ts","sourceRoot":"","sources":["../../../src/packages/multisig/multisig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,qBAAa,QAAS,SAAQ,MAAM;
|
|
1
|
+
{"version":3,"file":"multisig.d.ts","sourceRoot":"","sources":["../../../src/packages/multisig/multisig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAc,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;GAGG;AACH,qBAAa,QAAS,SAAQ,MAAM;IAalC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAR3B;;;;;OAKG;gBAEF,MAAM,CAAC,EAAE,YAAY,EACJ,QAAQ,CAAC,0BAAc;IASzC;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,kBAAkB,CAAC,MAAM,EAAE,mBAAmB;IAQrD;;;OAGG;IACH,OAAO,CAAC,WAAW,CAIjB;CACF"}
|