@trufnetwork/sdk-js 0.5.10 → 0.6.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.
Files changed (60) hide show
  1. package/README.md +45 -0
  2. package/dist/cjs/client/client.cjs +30 -0
  3. package/dist/cjs/client/client.cjs.map +2 -2
  4. package/dist/cjs/contracts-api/action.cjs +22 -0
  5. package/dist/cjs/contracts-api/action.cjs.map +2 -2
  6. package/dist/cjs/contracts-api/action.test.cjs +63 -0
  7. package/dist/cjs/contracts-api/action.test.cjs.map +7 -0
  8. package/dist/cjs/contracts-api/orderbookAction.cjs +880 -0
  9. package/dist/cjs/contracts-api/orderbookAction.cjs.map +7 -0
  10. package/dist/cjs/internal.cjs +9 -0
  11. package/dist/cjs/internal.cjs.map +2 -2
  12. package/dist/cjs/types/bridge.cjs.map +1 -1
  13. package/dist/cjs/types/orderbook.cjs +19 -0
  14. package/dist/cjs/types/orderbook.cjs.map +7 -0
  15. package/dist/cjs/util/AttestationEncoding.cjs +3 -2
  16. package/dist/cjs/util/AttestationEncoding.cjs.map +2 -2
  17. package/dist/cjs/util/orderbookHelpers.cjs +194 -0
  18. package/dist/cjs/util/orderbookHelpers.cjs.map +7 -0
  19. package/dist/cjs/util/orderbookHelpers.test.cjs +217 -0
  20. package/dist/cjs/util/orderbookHelpers.test.cjs.map +7 -0
  21. package/dist/esm/client/client.mjs +30 -0
  22. package/dist/esm/client/client.mjs.map +2 -2
  23. package/dist/esm/contracts-api/action.mjs +22 -0
  24. package/dist/esm/contracts-api/action.mjs.map +2 -2
  25. package/dist/esm/contracts-api/action.test.mjs +61 -0
  26. package/dist/esm/contracts-api/action.test.mjs.map +7 -0
  27. package/dist/esm/contracts-api/orderbookAction.mjs +875 -0
  28. package/dist/esm/contracts-api/orderbookAction.mjs.map +7 -0
  29. package/dist/esm/internal.mjs +16 -0
  30. package/dist/esm/internal.mjs.map +2 -2
  31. package/dist/esm/types/orderbook.mjs +1 -0
  32. package/dist/esm/types/orderbook.mjs.map +7 -0
  33. package/dist/esm/util/AttestationEncoding.mjs +3 -2
  34. package/dist/esm/util/AttestationEncoding.mjs.map +2 -2
  35. package/dist/esm/util/orderbookHelpers.mjs +173 -0
  36. package/dist/esm/util/orderbookHelpers.mjs.map +7 -0
  37. package/dist/esm/util/orderbookHelpers.test.mjs +229 -0
  38. package/dist/esm/util/orderbookHelpers.test.mjs.map +7 -0
  39. package/dist/tsconfig.build.tsbuildinfo +1 -1
  40. package/dist/types/client/client.d.ts +23 -1
  41. package/dist/types/client/client.d.ts.map +1 -1
  42. package/dist/types/contracts-api/action.d.ts +11 -1
  43. package/dist/types/contracts-api/action.d.ts.map +1 -1
  44. package/dist/types/contracts-api/action.test.d.ts +2 -0
  45. package/dist/types/contracts-api/action.test.d.ts.map +1 -0
  46. package/dist/types/contracts-api/orderbookAction.d.ts +303 -0
  47. package/dist/types/contracts-api/orderbookAction.d.ts.map +1 -0
  48. package/dist/types/internal.d.ts +3 -0
  49. package/dist/types/internal.d.ts.map +1 -1
  50. package/dist/types/types/bridge.d.ts +45 -0
  51. package/dist/types/types/bridge.d.ts.map +1 -1
  52. package/dist/types/types/orderbook.d.ts +376 -0
  53. package/dist/types/types/orderbook.d.ts.map +1 -0
  54. package/dist/types/util/AttestationEncoding.d.ts +9 -1
  55. package/dist/types/util/AttestationEncoding.d.ts.map +1 -1
  56. package/dist/types/util/orderbookHelpers.d.ts +161 -0
  57. package/dist/types/util/orderbookHelpers.d.ts.map +1 -0
  58. package/dist/types/util/orderbookHelpers.test.d.ts +2 -0
  59. package/dist/types/util/orderbookHelpers.test.d.ts.map +1 -0
  60. package/package.json +1 -1
@@ -0,0 +1,303 @@
1
+ /**
2
+ * Order Book Action API
3
+ *
4
+ * Provides methods for interacting with TRUF.NETWORK binary prediction markets.
5
+ * Markets are automatically settled based on real-world data from trusted data providers.
6
+ */
7
+ import { KwilSigner, NodeKwil, WebKwil, Types } from "@trufnetwork/kwil-js";
8
+ import { MarketInfo, MarketSummary, MarketValidation, OrderBookEntry, UserPosition, DepthLevel, BestPrices, UserCollateral, DistributionSummary, LPRewardDetail, RewardHistory, CreateMarketInput, PlaceOrderInput, PlaceSplitLimitOrderInput, CancelOrderInput, ChangeBidInput, ChangeAskInput, ListMarketsInput, CreatePriceThresholdMarketInput, CreateValueInRangeMarketInput, CreateValueEqualsMarketInput } from "../types/orderbook";
9
+ import { encodeActionArgs, encodeQueryComponents, encodeRangeActionArgs, encodeEqualsActionArgs } from "../util/orderbookHelpers";
10
+ /**
11
+ * OrderbookAction provides methods for interacting with binary prediction markets.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const client = new NodeTNClient({...});
16
+ * const orderbook = client.loadOrderbookAction();
17
+ *
18
+ * // Get market info
19
+ * const market = await orderbook.getMarketInfo(queryId);
20
+ *
21
+ * // Place a buy order
22
+ * await orderbook.placeBuyOrder({
23
+ * queryId: market.id,
24
+ * outcome: true, // YES
25
+ * price: 55, // 55 cents
26
+ * amount: 100, // 100 shares
27
+ * });
28
+ * ```
29
+ */
30
+ export declare class OrderbookAction {
31
+ protected kwilClient: WebKwil | NodeKwil;
32
+ protected kwilSigner: KwilSigner;
33
+ constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner);
34
+ /**
35
+ * Creates a new binary prediction market.
36
+ *
37
+ * @param input - Market creation parameters
38
+ * @returns Transaction receipt with tx_hash
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * const args = OrderbookAction.encodeActionArgs(
43
+ * dataProvider, streamId, timestamp, threshold, frozenAt
44
+ * );
45
+ * const queryComponents = OrderbookAction.encodeQueryComponents(
46
+ * dataProvider, streamId, "price_above_threshold", args
47
+ * );
48
+ *
49
+ * const result = await orderbook.createMarket({
50
+ * bridge: "hoodi_tt2",
51
+ * queryComponents,
52
+ * settleTime: Math.floor(Date.now() / 1000) + 3600,
53
+ * maxSpread: 10,
54
+ * minOrderSize: 1,
55
+ * });
56
+ * ```
57
+ */
58
+ createMarket(input: CreateMarketInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
59
+ /**
60
+ * Gets detailed information about a market.
61
+ *
62
+ * @param queryId - Market identifier
63
+ * @returns Full market information
64
+ */
65
+ getMarketInfo(queryId: number): Promise<MarketInfo>;
66
+ /**
67
+ * Gets market information by query hash.
68
+ *
69
+ * @param queryHash - SHA256 hash of query components (32 bytes)
70
+ * @returns Full market information
71
+ */
72
+ getMarketByHash(queryHash: Uint8Array): Promise<MarketInfo>;
73
+ /**
74
+ * Lists markets with optional filtering.
75
+ *
76
+ * @param input - Filter and pagination options
77
+ * @returns Array of market summaries
78
+ */
79
+ listMarkets(input?: ListMarketsInput): Promise<MarketSummary[]>;
80
+ /**
81
+ * Checks if a market exists for the given query hash.
82
+ *
83
+ * @param queryHash - SHA256 hash of query components (32 bytes)
84
+ * @returns true if market exists
85
+ */
86
+ marketExists(queryHash: Uint8Array): Promise<boolean>;
87
+ /**
88
+ * Validates market collateral integrity.
89
+ *
90
+ * Checks that:
91
+ * - YES and NO token counts match (binary pairs)
92
+ * - Vault balance matches expected collateral
93
+ *
94
+ * @param queryId - Market identifier
95
+ * @returns Validation result with detailed breakdown
96
+ */
97
+ validateMarketCollateral(queryId: number): Promise<MarketValidation>;
98
+ /**
99
+ * Places a buy order for shares.
100
+ *
101
+ * Locks collateral: amount × price × 10^16 wei
102
+ *
103
+ * @param input - Order parameters
104
+ * @returns Transaction receipt
105
+ */
106
+ placeBuyOrder(input: PlaceOrderInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
107
+ /**
108
+ * Places a sell order for owned shares.
109
+ *
110
+ * @param input - Order parameters
111
+ * @returns Transaction receipt
112
+ */
113
+ placeSellOrder(input: PlaceOrderInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
114
+ /**
115
+ * Places a split limit order for market making.
116
+ *
117
+ * Atomically:
118
+ * 1. Locks collateral (amount × $1.00)
119
+ * 2. Mints a YES/NO share pair
120
+ * 3. Keeps YES shares as holdings
121
+ * 4. Places NO shares as a sell order at (100 - truePrice) cents
122
+ *
123
+ * @param input - Order parameters
124
+ * @returns Transaction receipt
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * // Create 100 pairs at YES=55¢, NO=45¢
129
+ * await orderbook.placeSplitLimitOrder({
130
+ * queryId: market.id,
131
+ * truePrice: 55,
132
+ * amount: 100,
133
+ * });
134
+ * // Result: 100 YES holdings + 100 NO sell orders at 45¢
135
+ * ```
136
+ */
137
+ placeSplitLimitOrder(input: PlaceSplitLimitOrderInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
138
+ /**
139
+ * Cancels an open order.
140
+ *
141
+ * Cannot cancel holdings (price = 0).
142
+ *
143
+ * @param input - Order to cancel
144
+ * @returns Transaction receipt
145
+ */
146
+ cancelOrder(input: CancelOrderInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
147
+ /**
148
+ * Modifies a buy order atomically.
149
+ *
150
+ * Preserves FIFO queue position via timestamp inheritance.
151
+ *
152
+ * @param input - Bid modification parameters
153
+ * @returns Transaction receipt
154
+ */
155
+ changeBid(input: ChangeBidInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
156
+ /**
157
+ * Modifies a sell order atomically.
158
+ *
159
+ * Preserves FIFO queue position via timestamp inheritance.
160
+ *
161
+ * @param input - Ask modification parameters
162
+ * @returns Transaction receipt
163
+ */
164
+ changeAsk(input: ChangeAskInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
165
+ /**
166
+ * Gets the order book for a market outcome.
167
+ *
168
+ * Returns all buy and sell orders (excludes holdings).
169
+ *
170
+ * @param queryId - Market identifier
171
+ * @param outcome - true=YES, false=NO
172
+ * @returns Array of order book entries
173
+ */
174
+ getOrderBook(queryId: number, outcome: boolean): Promise<OrderBookEntry[]>;
175
+ /**
176
+ * Gets the caller's positions across all markets.
177
+ *
178
+ * @returns Array of user positions (holdings and orders)
179
+ */
180
+ getUserPositions(): Promise<UserPosition[]>;
181
+ /**
182
+ * Gets aggregated market depth for an outcome.
183
+ *
184
+ * @param queryId - Market identifier
185
+ * @param outcome - true=YES, false=NO
186
+ * @returns Array of depth levels (price + total volume)
187
+ */
188
+ getMarketDepth(queryId: number, outcome: boolean): Promise<DepthLevel[]>;
189
+ /**
190
+ * Gets the best bid and ask prices for an outcome.
191
+ *
192
+ * @param queryId - Market identifier
193
+ * @param outcome - true=YES, false=NO
194
+ * @returns Best prices and spread
195
+ */
196
+ getBestPrices(queryId: number, outcome: boolean): Promise<BestPrices>;
197
+ /**
198
+ * Gets the caller's total locked collateral.
199
+ *
200
+ * @returns Collateral breakdown
201
+ */
202
+ getUserCollateral(): Promise<UserCollateral>;
203
+ /**
204
+ * Settles a market using attestation results.
205
+ *
206
+ * Can only be called after settle_time has passed.
207
+ * Automatically distributes payouts and LP rewards.
208
+ *
209
+ * @param queryId - Market identifier
210
+ * @returns Transaction receipt
211
+ */
212
+ settleMarket(queryId: number): Promise<Types.GenericResponse<Types.TxReceipt>>;
213
+ /**
214
+ * Samples LP rewards for a specific block.
215
+ *
216
+ * Should be called periodically to track LP eligibility.
217
+ *
218
+ * @param queryId - Market identifier
219
+ * @param block - Block height to sample
220
+ * @returns Transaction receipt
221
+ */
222
+ sampleLPRewards(queryId: number, block: number): Promise<Types.GenericResponse<Types.TxReceipt>>;
223
+ /**
224
+ * Gets the fee distribution summary for a market.
225
+ *
226
+ * @param queryId - Market identifier
227
+ * @returns Distribution summary
228
+ */
229
+ getDistributionSummary(queryId: number): Promise<DistributionSummary>;
230
+ /**
231
+ * Gets detailed reward breakdown for a distribution.
232
+ *
233
+ * @param distributionId - Distribution identifier
234
+ * @returns Array of per-LP reward details
235
+ */
236
+ getDistributionDetails(distributionId: number): Promise<LPRewardDetail[]>;
237
+ /**
238
+ * Gets reward history for a participant.
239
+ *
240
+ * @param walletHex - Wallet address (0x-prefixed hex)
241
+ * @returns Array of reward history entries
242
+ */
243
+ getParticipantRewardHistory(walletHex: string): Promise<RewardHistory[]>;
244
+ /**
245
+ * Creates a "price above threshold" market.
246
+ *
247
+ * YES wins if price > threshold at settlement time.
248
+ *
249
+ * @param input - Market parameters
250
+ * @returns Transaction receipt
251
+ */
252
+ createPriceAboveThresholdMarket(input: CreatePriceThresholdMarketInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
253
+ /**
254
+ * Creates a "price below threshold" market.
255
+ *
256
+ * YES wins if price < threshold at settlement time.
257
+ *
258
+ * @param input - Market parameters
259
+ * @returns Transaction receipt
260
+ */
261
+ createPriceBelowThresholdMarket(input: CreatePriceThresholdMarketInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
262
+ /**
263
+ * Creates a "value in range" market.
264
+ *
265
+ * YES wins if minValue <= value <= maxValue at settlement time.
266
+ *
267
+ * @param input - Market parameters
268
+ * @returns Transaction receipt
269
+ */
270
+ createValueInRangeMarket(input: CreateValueInRangeMarketInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
271
+ /**
272
+ * Creates a "value equals" market.
273
+ *
274
+ * YES wins if |value - targetValue| <= tolerance at settlement time.
275
+ *
276
+ * @param input - Market parameters
277
+ * @returns Transaction receipt
278
+ */
279
+ createValueEqualsMarket(input: CreateValueEqualsMarketInput): Promise<Types.GenericResponse<Types.TxReceipt>>;
280
+ /**
281
+ * Encodes action arguments for query components.
282
+ * @see encodeActionArgs
283
+ */
284
+ static encodeActionArgs: typeof encodeActionArgs;
285
+ /**
286
+ * Encodes query components for market creation.
287
+ * @see encodeQueryComponents
288
+ */
289
+ static encodeQueryComponents: typeof encodeQueryComponents;
290
+ /**
291
+ * Encodes action arguments for range markets.
292
+ * @see encodeRangeActionArgs
293
+ */
294
+ static encodeRangeActionArgs: typeof encodeRangeActionArgs;
295
+ /**
296
+ * Encodes action arguments for equals markets.
297
+ * @see encodeEqualsActionArgs
298
+ */
299
+ static encodeEqualsActionArgs: typeof encodeEqualsActionArgs;
300
+ private parseMarketInfo;
301
+ private parseMarketSummary;
302
+ }
303
+ //# sourceMappingURL=orderbookAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderbookAction.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/orderbookAction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EACL,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAa7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EAQvB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,eAAe;IAC1B,SAAS,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,CAAC;IACzC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;gBAErB,UAAU,EAAE,OAAO,GAAG,QAAQ,EAAE,UAAU,EAAE,UAAU;IASlE;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,YAAY,CAChB,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAyBlD;;;;;OAKG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAsBzD;;;;;OAKG;IACG,eAAe,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IA0BjE;;;;;OAKG;IACG,WAAW,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAwBrE;;;;;OAK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CAAC,eAAe,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IA8BlD;;;OAGG;IACH,MAAM,CAAC,gBAAgB,0BAAoB;IAE3C;;;OAGG;IACH,MAAM,CAAC,qBAAqB,+BAAyB;IAErD;;;OAGG;IACH,MAAM,CAAC,qBAAqB,+BAAyB;IAErD;;;OAGG;IACH,MAAM,CAAC,sBAAsB,gCAA0B;IAMvD,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,kBAAkB;CAY3B"}
@@ -9,6 +9,7 @@ export { PrimitiveAction } from "./contracts-api/primitiveAction";
9
9
  export { ComposedAction } from "./contracts-api/composedAction";
10
10
  export { RoleManagement } from "./contracts-api/roleManagement";
11
11
  export { AttestationAction } from "./contracts-api/attestationAction";
12
+ export { OrderbookAction } from "./contracts-api/orderbookAction";
12
13
  export { deployStream } from "./contracts-api/deployStream";
13
14
  export { deleteStream } from "./contracts-api/deleteStream";
14
15
  export { StreamId } from "./util/StreamId";
@@ -25,4 +26,6 @@ export type { GrantRoleInput, RevokeRoleInput, AreMembersOfInput, WalletMembersh
25
26
  export type { RequestAttestationInput, RequestAttestationResult, GetSignedAttestationInput, SignedAttestationResult, ListAttestationsInput, AttestationMetadata } from "./types/attestation";
26
27
  export type { WithdrawalProof } from "./types/bridge";
27
28
  export type { VisibilityEnum } from "./util/visibility";
29
+ export type { BridgeIdentifier, MarketInfo, MarketSummary, MarketValidation, OrderBookEntry, UserPosition, DepthLevel, BestPrices, UserCollateral, DistributionSummary, LPRewardDetail, RewardHistory, CreateMarketInput, PlaceOrderInput, PlaceSplitLimitOrderInput, CancelOrderInput, ChangeBidInput, ChangeAskInput, ListMarketsInput, BaseBinaryMarketInput, CreatePriceThresholdMarketInput, CreateValueInRangeMarketInput, CreateValueEqualsMarketInput, } from "./types/orderbook";
30
+ export { encodeActionArgs, encodeQueryComponents, encodeRangeActionArgs, encodeEqualsActionArgs, hexToBytes, bytesToHex, } from "./util/orderbookHelpers";
28
31
  //# sourceMappingURL=intern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Transaction history record from the bridge extension.
71
+ */
72
+ export interface BridgeHistory {
73
+ /**
74
+ * The type of transaction ('deposit', 'withdrawal', 'transfer')
75
+ */
76
+ type: string;
77
+ /**
78
+ * The amount transferred/deposited/withdrawn
79
+ */
80
+ amount: string;
81
+ /**
82
+ * The sender address (null for deposits)
83
+ */
84
+ from_address: string | null;
85
+ /**
86
+ * The recipient address
87
+ */
88
+ to_address: string;
89
+ /**
90
+ * The Kwil transaction hash (null for deposits, if not linked)
91
+ */
92
+ internal_tx_hash: string | null;
93
+ /**
94
+ * The external transaction hash (null for internal transfers)
95
+ */
96
+ external_tx_hash: string | null;
97
+ /**
98
+ * The status of the transaction ('completed', 'pending_epoch', 'claimed')
99
+ */
100
+ status: string;
101
+ /**
102
+ * The Kwil block height
103
+ */
104
+ block_height: number;
105
+ /**
106
+ * The timestamp of the block (Unix timestamp)
107
+ */
108
+ block_timestamp: number;
109
+ /**
110
+ * The external block height (if applicable)
111
+ */
112
+ external_block_height: number | null;
113
+ }
69
114
  //# sourceMappingURL=bridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../src/types/bridge.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB;;;;OAIG;IACH,UA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