@naviprotocol/multiply 0.2.0-preview.20261102.2 → 0.2.0-preview.20261118.2
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 +132 -170
- package/dist/cap-registry.d.ts +18 -0
- package/dist/cap-registry.d.ts.map +1 -0
- package/dist/cap-registry.js +85 -0
- package/dist/cap-registry.js.map +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +390 -320
- package/dist/client.js.map +1 -1
- package/dist/converters.d.ts.map +1 -1
- package/dist/converters.js +200 -140
- package/dist/converters.js.map +1 -1
- package/dist/data-source.d.ts +5 -2
- package/dist/data-source.d.ts.map +1 -1
- package/dist/data-source.js +233 -169
- package/dist/data-source.js.map +1 -1
- package/dist/funding.d.ts +5 -0
- package/dist/funding.d.ts.map +1 -0
- package/dist/funding.js +68 -0
- package/dist/funding.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -15
- package/dist/index.js.map +1 -1
- package/dist/planner.d.ts +1 -1
- package/dist/planner.d.ts.map +1 -1
- package/dist/planner.js +276 -187
- package/dist/planner.js.map +1 -1
- package/dist/strategies.d.ts +8 -1
- package/dist/strategies.d.ts.map +1 -1
- package/dist/strategies.js +13 -12
- package/dist/strategies.js.map +1 -1
- package/dist/types.d.ts +69 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/funding.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { check as w, sameCoin as p, uint as y, BN as l } from "./utils.js";
|
|
2
|
+
function h(u) {
|
|
3
|
+
const e = u.execution, i = u.strategy, n = u.action, t = (a) => w(a, "INVALID_QUOTE", "Execution funding or conversion roles do not match the action"), m = n.type === "repay" ? i.debtCoinType : n.type === "add_collateral" ? i.collateralCoinType : n.type === "open" || n.type === "add_principal" ? n.inputCoinType ?? i.principalCoinType : void 0;
|
|
4
|
+
if (m) {
|
|
5
|
+
if (t("amount" in n && u.estimate.inputs.length === 1 && e.funding.kind !== "none"), !("amount" in n) || e.funding.kind === "none") return;
|
|
6
|
+
t(
|
|
7
|
+
u.estimate.inputs[0].amount === n.amount && p(u.estimate.inputs[0].coinType, m)
|
|
8
|
+
), t(e.funding.input.amount === n.amount && p(e.funding.input.coinType, m)), t(e.funding.kind === (p(m, i.collateralCoinType) ? "collateral" : "debt")), (n.type === "open" || n.type === "add_principal") && t(
|
|
9
|
+
(i.acceptedInputCoinTypes ?? [i.principalCoinType]).some(
|
|
10
|
+
(a) => p(a, m)
|
|
11
|
+
)
|
|
12
|
+
);
|
|
13
|
+
} else t(u.estimate.inputs.length === 0 && e.funding.kind === "none");
|
|
14
|
+
for (const a of [
|
|
15
|
+
e.flashAmount,
|
|
16
|
+
e.flashRepayment,
|
|
17
|
+
e.borrowAmount,
|
|
18
|
+
e.borrowFee,
|
|
19
|
+
e.withdrawAmount,
|
|
20
|
+
e.collateralAfter,
|
|
21
|
+
e.minCollateralAfter,
|
|
22
|
+
e.debtAfter
|
|
23
|
+
])
|
|
24
|
+
y(a);
|
|
25
|
+
t(e.conversions.length <= 1);
|
|
26
|
+
const o = e.conversions.at(0), c = new l(e.snapshot.collateralAmount), d = new l(e.snapshot.debtAmount), s = e.funding.kind === "none" ? new l(0) : new l(e.funding.input.amount), r = (a, f) => t(f.eq(a));
|
|
27
|
+
if (n.type === "repay" || n.type === "add_collateral")
|
|
28
|
+
t(
|
|
29
|
+
e.direction === n.type && !o && e.flashAmount === "0" && e.flashRepayment === "0" && e.borrowAmount === "0" && e.borrowFee === "0" && e.withdrawAmount === "0"
|
|
30
|
+
), r(e.collateralAfter, n.type === "add_collateral" ? c.plus(s) : c), r(e.debtAfter, n.type === "repay" ? l.maximum(0, d.minus(s)) : d), t(e.minCollateralAfter === e.collateralAfter);
|
|
31
|
+
else if (e.direction === "increase") {
|
|
32
|
+
t(
|
|
33
|
+
["open", "add_principal", "set_leverage"].includes(n.type) && e.withdrawAmount === "0" && e.borrowAmount === e.flashRepayment
|
|
34
|
+
);
|
|
35
|
+
const a = e.funding.kind === "collateral", f = new l(e.flashAmount).plus(a ? 0 : s);
|
|
36
|
+
t(!!o === f.gt(0)), o && (t(
|
|
37
|
+
o.id === "increase" && o.purpose === (e.flashAmount !== "0" ? "leverage" : "input")
|
|
38
|
+
), t(
|
|
39
|
+
o.source === (a || s.isZero() ? "flash" : e.flashAmount !== "0" ? "wallet-and-flash" : "wallet")
|
|
40
|
+
), t(
|
|
41
|
+
p(o.input.coinType, i.debtCoinType) && p(o.expectedOutput.coinType, i.collateralCoinType)
|
|
42
|
+
), r(o.input.amount, f)), r(e.collateralAfter, c.plus(a ? s : 0).plus(o?.expectedOutput.amount ?? 0)), r(e.minCollateralAfter, c.plus(a ? s : 0).plus(o?.minOutput.amount ?? 0)), r(e.debtAfter, d.plus(e.flashRepayment).plus(e.borrowFee));
|
|
43
|
+
} else {
|
|
44
|
+
t(
|
|
45
|
+
e.direction === "decrease" && ["remove_principal", "set_leverage", "close"].includes(n.type) && e.borrowAmount === "0" && e.borrowFee === "0"
|
|
46
|
+
), t(e.funding.kind === "none" && e.minCollateralAfter === e.collateralAfter), r(e.collateralAfter, c.minus(e.withdrawAmount)), r(e.debtAfter, l.maximum(0, d.minus(e.flashAmount)));
|
|
47
|
+
const a = p(i.principalCoinType, i.collateralCoinType);
|
|
48
|
+
o ? (t(
|
|
49
|
+
o.purpose === "repayment" && o.source === "withdrawal" && p(o.input.coinType, i.collateralCoinType) && p(o.expectedOutput.coinType, i.debtCoinType)
|
|
50
|
+
), t(
|
|
51
|
+
new l(o.input.amount).lte(e.withdrawAmount) && new l(o.minOutput.amount).gte(e.flashRepayment)
|
|
52
|
+
), a || t(o.input.amount === e.withdrawAmount)) : t(a && e.flashAmount === "0" && e.flashRepayment === "0"), n.type === "remove_principal" && t(
|
|
53
|
+
a ? new l(e.withdrawAmount).minus(o?.input.amount ?? 0).gte(n.amount) : new l(o?.minOutput.amount ?? 0).minus(e.flashRepayment).gte(n.amount)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
r(
|
|
57
|
+
e.flashRepayment,
|
|
58
|
+
new l(e.flashAmount).times(new l(e.market.flash.feeBps).div(1e4).plus(1)).integerValue(l.ROUND_CEIL)
|
|
59
|
+
);
|
|
60
|
+
for (const a of [...u.estimate.outputs, ...u.estimate.minOutputs])
|
|
61
|
+
y(a.amount, !1), t(
|
|
62
|
+
p(a.coinType, i.collateralCoinType) || p(a.coinType, i.debtCoinType)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
h as validateFunding
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=funding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"funding.js","sources":["../src/funding.ts"],"sourcesContent":["import type { MultiplyQuote } from './types'\nimport { BN, check, sameCoin, uint } from './utils'\n\n/** Independently check fixed-flow conservation; the checksum is not authorization. */\nexport function validateFunding(q: MultiplyQuote) {\n const e = q.execution,\n s = q.strategy,\n a = q.action\n const valid = (value: unknown) =>\n check(value, 'INVALID_QUOTE', 'Execution funding or conversion roles do not match the action')\n const inputType =\n a.type === 'repay'\n ? s.debtCoinType\n : a.type === 'add_collateral'\n ? s.collateralCoinType\n : a.type === 'open' || a.type === 'add_principal'\n ? (a.inputCoinType ?? s.principalCoinType)\n : undefined\n if (inputType) {\n valid('amount' in a && q.estimate.inputs.length === 1 && e.funding.kind !== 'none')\n if (!('amount' in a) || e.funding.kind === 'none') return\n valid(\n q.estimate.inputs[0].amount === a.amount && sameCoin(q.estimate.inputs[0].coinType, inputType)\n )\n valid(e.funding.input.amount === a.amount && sameCoin(e.funding.input.coinType, inputType))\n valid(e.funding.kind === (sameCoin(inputType, s.collateralCoinType) ? 'collateral' : 'debt'))\n if (a.type === 'open' || a.type === 'add_principal')\n valid(\n (s.acceptedInputCoinTypes ?? [s.principalCoinType]).some((type) =>\n sameCoin(type, inputType)\n )\n )\n } else valid(q.estimate.inputs.length === 0 && e.funding.kind === 'none')\n for (const amount of [\n e.flashAmount,\n e.flashRepayment,\n e.borrowAmount,\n e.borrowFee,\n e.withdrawAmount,\n e.collateralAfter,\n e.minCollateralAfter,\n e.debtAfter\n ])\n uint(amount)\n valid(e.conversions.length <= 1) // Current two-asset flows combine same-token funding before conversion.\n const conversion = e.conversions.at(0)\n const C = new BN(e.snapshot.collateralAmount),\n D = new BN(e.snapshot.debtAmount)\n const P = e.funding.kind === 'none' ? new BN(0) : new BN(e.funding.input.amount)\n const eq = (amount: string, value: InstanceType<typeof BN>) => valid(value.eq(amount))\n if (a.type === 'repay' || a.type === 'add_collateral') {\n valid(\n e.direction === a.type &&\n !conversion &&\n e.flashAmount === '0' &&\n e.flashRepayment === '0' &&\n e.borrowAmount === '0' &&\n e.borrowFee === '0' &&\n e.withdrawAmount === '0'\n )\n eq(e.collateralAfter, a.type === 'add_collateral' ? C.plus(P) : C)\n eq(e.debtAfter, a.type === 'repay' ? BN.maximum(0, D.minus(P)) : D)\n valid(e.minCollateralAfter === e.collateralAfter)\n } else if (e.direction === 'increase') {\n valid(\n ['open', 'add_principal', 'set_leverage'].includes(a.type) &&\n e.withdrawAmount === '0' &&\n e.borrowAmount === e.flashRepayment\n )\n const direct = e.funding.kind === 'collateral'\n const amount = new BN(e.flashAmount).plus(direct ? 0 : P)\n valid(!!conversion === amount.gt(0))\n if (conversion) {\n valid(\n conversion.id === 'increase' &&\n conversion.purpose === (e.flashAmount !== '0' ? 'leverage' : 'input')\n )\n valid(\n conversion.source ===\n (direct || P.isZero() ? 'flash' : e.flashAmount !== '0' ? 'wallet-and-flash' : 'wallet')\n )\n valid(\n sameCoin(conversion.input.coinType, s.debtCoinType) &&\n sameCoin(conversion.expectedOutput.coinType, s.collateralCoinType)\n )\n eq(conversion.input.amount, amount)\n }\n eq(e.collateralAfter, C.plus(direct ? P : 0).plus(conversion?.expectedOutput.amount ?? 0))\n eq(e.minCollateralAfter, C.plus(direct ? P : 0).plus(conversion?.minOutput.amount ?? 0))\n eq(e.debtAfter, D.plus(e.flashRepayment).plus(e.borrowFee))\n } else {\n valid(\n e.direction === 'decrease' &&\n ['remove_principal', 'set_leverage', 'close'].includes(a.type) &&\n e.borrowAmount === '0' &&\n e.borrowFee === '0'\n )\n valid(e.funding.kind === 'none' && e.minCollateralAfter === e.collateralAfter)\n eq(e.collateralAfter, C.minus(e.withdrawAmount))\n eq(e.debtAfter, BN.maximum(0, D.minus(e.flashAmount)))\n const collateralPrincipal = sameCoin(s.principalCoinType, s.collateralCoinType)\n if (conversion) {\n valid(\n conversion.purpose === 'repayment' &&\n conversion.source === 'withdrawal' &&\n sameCoin(conversion.input.coinType, s.collateralCoinType) &&\n sameCoin(conversion.expectedOutput.coinType, s.debtCoinType)\n )\n valid(\n new BN(conversion.input.amount).lte(e.withdrawAmount) &&\n new BN(conversion.minOutput.amount).gte(e.flashRepayment)\n )\n if (!collateralPrincipal) valid(conversion.input.amount === e.withdrawAmount)\n } else valid(collateralPrincipal && e.flashAmount === '0' && e.flashRepayment === '0')\n if (a.type === 'remove_principal')\n valid(\n collateralPrincipal\n ? new BN(e.withdrawAmount).minus(conversion?.input.amount ?? 0).gte(a.amount)\n : new BN(conversion?.minOutput.amount ?? 0).minus(e.flashRepayment).gte(a.amount)\n )\n }\n eq(\n e.flashRepayment,\n new BN(e.flashAmount)\n .times(new BN(e.market.flash.feeBps).div(10000).plus(1))\n .integerValue(BN.ROUND_CEIL)\n )\n for (const output of [...q.estimate.outputs, ...q.estimate.minOutputs]) {\n uint(output.amount, false)\n valid(\n sameCoin(output.coinType, s.collateralCoinType) || sameCoin(output.coinType, s.debtCoinType)\n )\n }\n}\n"],"names":["validateFunding","q","s","a","valid","value","check","inputType","sameCoin","type","amount","uint","conversion","C","BN","D","P","eq","direct","collateralPrincipal","output"],"mappings":";AAIO,SAASA,EAAgBC,GAAkB;AAChD,QAAM,IAAIA,EAAE,WACVC,IAAID,EAAE,UACNE,IAAIF,EAAE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AAW,MAAM,WAAW,EAAE,cAAc,OACjEO,KAAuB,EAAE,gBAAgB,OAAO,EAAE,mBAAmB,GAAG,GACjFhB,EAAE,SAAS,sBACbC;AAAA,MACEe,IACI,IAAIL,EAAG,EAAE,cAAc,EAAE,MAAMF,GAAY,MAAM,UAAU,CAAC,EAAE,IAAIT,EAAE,MAAM,IAC1E,IAAIW,EAAGF,GAAY,UAAU,UAAU,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,IAAIT,EAAE,MAAM;AAAA,IAAA;AAAA,EAExF;AACA,EAAAc;AAAA,IACE,EAAE;AAAA,IACF,IAAIH,EAAG,EAAE,WAAW,EACjB,MAAM,IAAIA,EAAG,EAAE,OAAO,MAAM,MAAM,EAAE,IAAI,GAAK,EAAE,KAAK,CAAC,CAAC,EACtD,aAAaA,EAAG,UAAU;AAAA,EAAA;AAE/B,aAAWM,KAAU,CAAC,GAAGnB,EAAE,SAAS,SAAS,GAAGA,EAAE,SAAS,UAAU;AACnE,IAAAU,EAAKS,EAAO,QAAQ,EAAK,GACzBhB;AAAA,MACEI,EAASY,EAAO,UAAUlB,EAAE,kBAAkB,KAAKM,EAASY,EAAO,UAAUlB,EAAE,YAAY;AAAA,IAAA;AAGjG;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { createMultiplyClient } from './client.js';
|
|
2
2
|
export { createNaviDataSource, ACCOUNT_CAP_TYPE } from './data-source.js';
|
|
3
3
|
export { voloConverter, haedalConverter, astrosConverter } from './converters.js';
|
|
4
|
-
export { strategies, SUI, VSUI, HASUI
|
|
4
|
+
export { strategies, SUI, VSUI, HASUI } from './strategies.js';
|
|
5
|
+
export { MAINNET_CAP_REGISTRY, normalizeCapRegistry, registryKeyString } from './cap-registry.js';
|
|
5
6
|
export { MultiplyError } from './utils.js';
|
|
6
7
|
export type * from './types.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,mBAAmB,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { createMultiplyClient as o } from "./client.js";
|
|
2
|
-
import {
|
|
3
|
-
import { astrosConverter as
|
|
4
|
-
import { HASUI as
|
|
5
|
-
import {
|
|
2
|
+
import { createNaviDataSource as a } from "./data-source.js";
|
|
3
|
+
import { astrosConverter as p, haedalConverter as C, voloConverter as l } from "./converters.js";
|
|
4
|
+
import { HASUI as f, SUI as n, VSUI as s, strategies as x } from "./strategies.js";
|
|
5
|
+
import { ACCOUNT_CAP_TYPE as v, MAINNET_CAP_REGISTRY as y, normalizeCapRegistry as A, registryKeyString as I } from "./cap-registry.js";
|
|
6
|
+
import { MultiplyError as E } from "./utils.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
v as ACCOUNT_CAP_TYPE,
|
|
9
|
+
f as HASUI,
|
|
10
|
+
y as MAINNET_CAP_REGISTRY,
|
|
11
|
+
E as MultiplyError,
|
|
12
|
+
n as SUI,
|
|
13
|
+
s as VSUI,
|
|
14
|
+
p as astrosConverter,
|
|
14
15
|
o as createMultiplyClient,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
a as createNaviDataSource,
|
|
17
|
+
C as haedalConverter,
|
|
18
|
+
A as normalizeCapRegistry,
|
|
19
|
+
I as registryKeyString,
|
|
20
|
+
x as strategies,
|
|
21
|
+
l as voloConverter
|
|
19
22
|
};
|
|
20
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/dist/planner.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare function metrics(position: PositionAmounts, market: MarketSnapsho
|
|
|
7
7
|
export declare function validateAction(action: Action, constraints: Constraints): void;
|
|
8
8
|
export declare function chooseConversion(req: ConversionRequest, converters: Converter[], fallback: Converter): Promise<ConversionQuote>;
|
|
9
9
|
export declare function plan(strategy: Strategy, action: Action, constraints: Constraints, snapshot: PositionAmounts, market: MarketSnapshot, borrowFeeBps: string, convert: (req: ConversionRequest) => Promise<ConversionQuote>): Promise<{
|
|
10
|
-
execution: Omit<ExecutionPlan, "accountCap" | "checksum">;
|
|
10
|
+
execution: Omit<ExecutionPlan, "accountCap" | "capRegistry" | "checksum">;
|
|
11
11
|
estimate: {
|
|
12
12
|
healthFactor: string | null;
|
|
13
13
|
leverage: string | null;
|
package/dist/planner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../src/planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,cAAc,EACd,eAAe,EACf,QAAQ,EACT,MAAM,SAAS,CAAA;AAOhB,wBAAgB,OAAO,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc;;;EAWxE;AACD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,QAgCtE;AACD,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,iBAAiB,EACtB,UAAU,EAAE,SAAS,EAAE,EACvB,QAAQ,EAAE,SAAS,GAClB,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../src/planner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,cAAc,EACd,eAAe,EACf,QAAQ,EACT,MAAM,SAAS,CAAA;AAOhB,wBAAgB,OAAO,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc;;;EAWxE;AACD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,QAgCtE;AACD,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,iBAAiB,EACtB,UAAU,EAAE,SAAS,EAAE,EACvB,QAAQ,EAAE,SAAS,GAClB,OAAO,CAAC,eAAe,CAAC,CAqD1B;AACD,wBAAsB,IAAI,CACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,WAA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